No Module Named Scipy

Hi all. Looking to complete my Sea Level predictor code in the Python Data Analysis course.

I wrote my code in Jupyter notebook and it seems to produce what is asked for. When I copy and paste my code into replit and try to run it, I receive the error 'no module named scipy". I have of course called from scipy.stats import linregress, and have even tried just including import scipy, but nothing comes up. I have had similar issues with the Page View project.

I have tried the solution suggested here in updating replit.nix to no avail.

Replit: boilerplate-sea-level-predictor (4) - Replit

Maybe someone will come in with a more appropriate solution, as I believe there is a way you can make it install from your requirements.txt file, or the TOML or something, but for me I just manually install.

Basically its saying your Replit doesn’t have scipi installed. When I see that I just run pip install scipy in the console to have Replit install it.

Again, I am only surface level familiar with using pip and the intricacies of version management, but that hasn’t failed me yet.

1 Like

Jupyter runs python locally and pulls in whatever modules it needs automagically (I assume). This hides the fact that most of the time you’re in charge of dependencies.

This is likely the same dependency problem that exists for all the python data analysis projects. You’ll need to update your python version in pyproject.toml and uninstall and reinstall the dependencies to get a working set (just adding scipy with the replit package tool should pull the others in as well). I think current scipy wants python 3.9 and up.

Sometimes the repls get corrupted so if the above doesn’t work, reclone the boilerplate, copy your code, and then try updating your dependencies. I was testing your repl and it was acting corrupt, but that could just be replit.

1 Like

Simple and works, thank you.

Hi Jeremy. Thanks for your response. I tried Kinome’s solution first as it was more simple, and it worked for me in this case.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.