Kirill Korolev
Kirill Korolev

Reputation: 1006

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

Upvotes: 11

Views: 18350

Answers (3)

ah bon
ah bon

Reputation: 10011

My issue has been No module named 'scipy._lib._ccallback', it was solved by:

pip3 uninstall scipy==1.7.1
pip3 install scipy==1.4.1 --user

Upvotes: 0

Jack Hoy
Jack Hoy

Reputation: 91

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)

Upvotes: 8

user1410665
user1410665

Reputation: 759

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

Upvotes: 10

Related Questions