When I try to install scipy using pip install scipy it fails with the following traceback
Downloading/unpacking scipy
Downloading scipy-0.10.1.tar.gz (6.2M
if you use homebrew, you can try the following (thanks to https://github.com/pypa/pip/issues/707):
brew tap samueljohn/homebrew-python
brew install numpy
brew install scipy
This seems to be an issue with pip and numpy, which doesn't copy the compiled libraries into the site-packages directory.
You could install using pip into a virtualenv (which worked for me) or install from source using the
python setup.py install
method.
There are some comments about issue here:
http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/
If you don't use virtualenv
, then the least intrusive fix may be manually edit /usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/locations.py
(Your pip version may vary). Just replace line 35 from:
build_prefix = os.path.join(tempfile.gettempdir(), 'pip-build')
to:
build_prefix = os.path.realpath(os.path.join(tempfile.gettempdir(), 'pip-build'))
After this change, you need to reinstall numpy
(pip uninstall numpy; pip install numpy
). The scipy
can then be installed by pip correctly.
The issue is caused by a pip bug. And the solution above is according to the pip patch (suggested in the issue discussion mentioned by Lokkju) from github user qwcode. This patch seems to have been merged to main pip repository. However, I don't see an easy way to brew update pip since it's bundled with Python. So just manually making this simple fix works for me.
I had the same problem in 2015 with MacOSX Yosemite. I think it caused by pip's old version bug. Uninstalling pip and getting newest version of it helps. Get pip from https://pip.pypa.io/en/latest/installing.html and then
$ sudo pip uninstall scipy
$ sudo pip install scipy