Can someone please help me what should I do for this code to run?

I already tried multiple times to update python, pandas, seaborn, matplotlib and numpy versions but nothing helps.


Thank you in advance!

Hi @tcin4707 !
Could you send the contents of your pyproject.toml and .replit file?
Thanks!

1 Like

There are two separate problems, which can both be fixed.

The first problem is poetry dependency resolving. Simply open your pyproject.toml and change python from ">=3.7,<3.9" to ">=3.9,<4.0" as the error message said.
Then, click three dots and Show hidden files, and open .replit file. Replace the contents with this:

entrypoint = "main.py"
modules = ["python-3.10:v18-20230807-322e88b"]

hidden = [".pythonlibs"]

[nix]
channel = "stable-23_05"

This will update your repl to newer configuration (python 3.10) and fix the Run error.
Run poetry update in the shell.

2 Likes

I did everything you wrote. Now when I try to run it’s not stopping and not running.

For me it worked fine (mostly).
The first run took a while (1 min) to load up, probably mostly from the library importing. (Add print statements to see where.)
The second run took less than 10 seconds to load up, and it works fine. (Probably cached stuff made it faster.)

You can also check your resources near the top, to see that it is loading stuff and maxed out.


do you you think it could be because of RAM used limit?

That is definitely a possibility. If too much RAM is used (max is around 1000 MiB, contrary to what it says), then the “cache” RAM has to be released, which may significantly slow down things.
Not sure why yours is maxing out.
Try:
kill 1 in the Shell.
“Lazy importing” (import libraries later in code). Also import less libraries if possible.

it looks like it’s running now but I don’t see the test result with numbers. Did it run successfully or not? thank you

this is actually the complete result I get:

 /home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
/home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
/home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
/home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
/home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
/home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
./home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
/home/runner/boilerplate-medical-data-visualizer/medical_data_visualizer.py:36: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(new_labels)
...
----------------------------------------------------------------------
Ran 4 tests in 9.399s

OK

Are you talking about the Output or something else?
If it is about the code itself, I probably can’t help you very much on it because I don’t know much.

If it is about the Output, then last time I checked, it worked fine. You could also put an input() at the end of your program so that the Output is visible for longer.

1 Like

now I am sure that the code is correct because it runs on pycharm perfectly. But it’s loading very long on replit and does not run. Any suggestions? Thank you!

According to the docs, matplotlib.pyplot.show — Matplotlib 3.8.2 documentation, the plt.show() call on line 69 will block (run for a while) by default usually.
Therefore, the print() later in the file does not execute automatically.
The reason why the behavior is different in PyCharm is probably because of the following:

(block) Defaults to True in non-interactive mode and to False in interactive mode (see pyplot.isinteractive).

It is often useful to use print statements or the Debugger tool to figure out where your code gets stuck so that you can identify the bottleneck or loop.