ModuleNotFoundError: No module named 'pandas' or 'numpy'

Hello friends.
I started facing this error in my third project Mean-Variance-Standard Deviation Calculator.
I tried to run other projects and now its in all of them. It seems at the back code can’t connect to python libraries.

Not sure how to resolve it. Any guidance would be appreciated.

I also read another thread on it but not sure what is the solution provided there and if anyone can please explain it to me. Unfortunately, i can’t post multiple links here but there is only one thread on google with this subject.

My project:- boilerplate-medical-data-visualizer-5 - Replit

I am using Google Chrome.

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Medical Data Visualizer

Link to the challenge:

2 Likes

I got the same problem with pandas

1 Like

Looks like replit has made some changes in handling dependencies.

Currently the most straightforward way I have found is adding required modules manually in the replit.nix file (it’s hidden, you will need to click three dots at the right of the Files tab and click Show hidden files ). Then add required modules in the deps, for this project it should look like:

  deps = [
    pkgs.python38Full
    pkgs.python38Packages.matplotlib
    pkgs.python38Packages.numpy
    pkgs.python38Packages.pandas
    pkgs.python38Packages.seaborn
  ];
4 Likes

I assume we need to add applicable replit.nix files now to all the repos for these projects so they will work like they used to?

1 Like

no sir , shows nix error

Could you say what error exactly, what’s your replit?

Hello friend,

Adding these
deps = [
pkgs.python38Full
pkgs.python38Packages.matplotlib
pkgs.python38Packages.numpy
pkgs.python38Packages.pandas
pkgs.python38Packages.seaborn
];

HAS WORKED (Bingo!)

Thanks a ton!!!.

Also, Thanks to everyone for replying to the post(respect!).
Please try the solution provided by sanity. i hope it works for you as well.

1 Like

The solution that was mentioned here (changing the replit.nix file) DOES NOT work for me. After reading the error thoroughly, it is said that the numpy package, on which pandas and matplotlib are built on, cannot be implemented because the python version that is used for the numpy library is too old. The solution that worked for me is the following:

Under Packager Files, open poetry.lock files. Scroll down until you find [[package]] with name = "numpy". Then change the python-versions = ">=3.7" to python-versions = ">=3.8".

None of the solutions showed so far have worked for me; I’ve added the modules as said and updated the python version in poetry.lock - Can anyone help?

Update: for anyone viewing this post with the same problem, this Data Analysis with Python Projects - Medical Data Visualizer solution worked perfectly for me.