Import error: No module named 'scipy._lib'

Kirill Korolev picture Kirill Korolev · May 18, 2018 · Viewed 7.2k times · Source

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

Answer

user1410665 picture user1410665 · Apr 27, 2019

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