Maximilian Körner
Maximilian Körner

Reputation: 894

python doesn't use updated pip scipy package

I'm currently working with scipy and having problems updating it. It is installed via pip and pip list gives me:

...  
scipy (0.13.2)  
...

But when I fire up my python and do:

import scipy
print scipy.__version__

I get:

0.11.0

Any idea where if got something wrong? Maybe the path? I was thinking python uses my pip packages as I installed scipy with it in the first place.

Additional Information:
Output of which python in terminal:

/usr/bin/python

Output of print sys.path:

'/Users/*MY_USER*/Documents/workspace/*MY_PROJECT*', 
'/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg', 
'/Users/*MY_USER*/Documents/workspace/*MY_PROJECT*', 
'/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', 'lib'

Output of print scipy.__path__:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy

Output of which pip:

/usr/local/bin/pip

UPDATE:
It seems, another version of scipy is pulled first from
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/
because it appears before the correct /Library/Python/2.7/site-packages

So if i run
sys.path.insert(1, "/Library/Python/2.7/site-packages")
the correct version of scipy is loaded!

So how can i fix this ordering issue clean and permanently? Platform OSX Mavericks.

Upvotes: 1

Views: 1584

Answers (1)

Doğukan Çağatay
Doğukan Çağatay

Reputation: 167

You can simply delete (or rename) the directories of old libraries or create symbolic links from updated packages. I firstly renamed, checked if everything works, then I deleted them.

In my case, pip is installing/updating the libraries in /Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages, so this directory always has the updated versions. However, my python primarily looks at /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python, where old version of scipy, numpy and matplotlib resides. When I deleted old versions, new python started loading updated modules.

Upvotes: 3

Related Questions