Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import error: No module named 'scipy._lib'

I'm using pythonanywere.com to deploy my Django application. So I've installed a few machine learning libraries to that virtual environment.

(venv) 19:16 ~ $ pip3 list
Package         Version           
--------------- ------------------
certifi         2018.4.16         
chardet         3.0.4             
DAWG-Python     0.7.2             
Django          2.0.5             
docopt          0.6.2             
idna            2.6               
numpy           1.14.3            
pip             10.0.1            
pymorphy2       0.8               
pymorphy2-dicts 2.4.393442.3710985
python-dateutil 2.7.3             
pytz            2018.4            
scikit-learn    0.19.1            
scipy           1.1.0             
setuptools      39.1.0            
six             1.11.0            
sklearn         0.0               
wheel           0.31.1 

But when I tried to python3 manage.py runserver I got this

    from sklearn.linear_model import SGDClassifier
  File "/home/kirillkorolev/.virtualenvs/venv/lib/python3.6/site-packages/sklearn/__init__.py", line 134, in <module>
    from .base import clone
  File "/home/kirillkorolev/.virtualenvs/venv/lib/python3.6/site-packages/sklearn/base.py", line 11, in <module>
    from scipy import sparse
  File "/home/kirillkorolev/.virtualenvs/venv/lib/python3.6/site-packages/scipy/__init__.py", line 110, in <module>
    from scipy._lib._version import NumpyVersion as _NumpyVersion
ModuleNotFoundError: No module named 'scipy._lib'

Previously I did the same thing on a local machine and it worked fine.

Tested in a console on pythonanywere.com under Ubuntu 14.04.5 LTS

like image 813
Kirill Korolev Avatar asked May 18 '18 19:05

Kirill Korolev


People also ask

How do I fix No module named Scipy?

The Python "ModuleNotFoundError: No module named 'scipy'" occurs when we forget to install the scipy module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install scipy command.

How do I import Scipy into Jupyter notebook?

We can install the SciPy library by using pip command; run the following command in the terminal: pip install scipy.


2 Answers

This is just an update. I also faced same error. Solution of this issue is installation of below package. sudo apt install --reinstall python*-decorator

like image 110
user1410665 Avatar answered Sep 25 '22 07:09

user1410665


This seemed to resolve itself for me just by running:

 pip uninstall scipy &&  pip install scipy

Even though I had the latest version of scipy (1.4.1)

like image 37
Jack Hoy Avatar answered Sep 24 '22 07:09

Jack Hoy