The module that should have been installed with pip does not run

Make a note of what to check if you are having trouble running the module that you should have installed with pip.

Execution environment

This time the phenomenon

>>> from scipy.stats import multivariate_normal
Import Error: cannot import name multivariate_normal

I thought that the version of scipy was old, and even if I looked it up, it was the latest (0.16.1)

$ pip list | grep scipy
scipy (0.16.1)

I checked various things.

Check module update with pip

update confirmation


$ pip install --upgrade scipy
Requirement already up-to-date: scipy in /usr/local/lib/python2.7/site-packages
Cleaning up...

Check module reference inside python

Reference confirmation


$ python -c 'import scipy; print scipy.__file__'
/Library/Python/2.7/site-packages/scipy/__init__.pyc

Is it different from the installation destination of pip?

$ ls /Library/Python/2.7/site-packages/site-packages | grep scipy
scipy
scipy-0.13.0-py2.7.egg-info

Confirm module reference path

$ python -c 'import sys; print sys.path'
['', '/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg', '/Library/Python/2.7/site-packages/Django-1.7.4-py2.7.egg', '/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/setuptools-8.2.1-py2.7.egg', '/usr/local/lib/python2.7/site-packages']

result

There are two site-packages in my python environment, and it seems that one site-packages is loaded with priority over the site-packages that is the installation destination with pip. And the cause was that I had installed the old scipy on the priority site-packages before I knew it. For the time being, delete the library not managed by pip and solve it. Speaking of which, when I created the Django environment, I didn't seem to have messed with the settings around here.

Recommended Posts

The module that should have been installed with pip does not run
When the program pip installed on Mac / Marvericks does not work
GAE forbidden: The caller does not have permission
I measured the time when I pip installed the C language dependent module with alpine
Examples and solutions that the Python version specified in pyenv does not run
The story that fits in with pip installation
[systemd] How to deal with the problem that fancontrol does not work after suspending
Import libraries that cannot be pip installed with PyCharm
Find out the location of packages installed with pip
Check when the version does not switch with pyenv
The attitude that programmers should have (The Zen of Python)
Can't find the package you installed with pip install --user?
Grep so that grep does not appear at the time of grep
Move what you installed with pip to the conda environment
I implemented a method to calculate the evaluation index (specificity, NPV) that scikit-learn does not have
How to deal with the error "Failed to load module" canberra-gtk-module "that appears when you run OpenCV
The story of not being able to run pygame with pycharm
The story of the release work of the application that Google does not tell
Calling time.sleep () after the print function with the argument end does not print
If you should have pip installed but get an Import error
The story of making a module that skips mail with python
An error that does not work as expected when calling the tkinter module in a text editor
What to do when you get angry that libxml / xmlversion.h does not exist when you put lxml with pip
If you try to start the jupyter notebook installed with pip and it says "command not found", it seems that you can go through the PATH.