I'm trying to install scipy numpy from source for installing scikit learn from source. I managed to do it for numpy and scikit but for scipy I get an error,
ImportError: No module named numpy.distutils.core
This is happening because numpy is not install in the site-packages directory for python, but in a custom directory. Any workaround this?
The point of installing to a custom "home" is that you want to make that part of your sys.path
. While you can do that by cd
ing into that directory and starting Python (because .
is part of the default sys.path
), that's rarely a good idea. What you probably want to do is set a PYTHONPATH
env variable, or extend your per-user site-packages, or something like that.
Or, even more simply, install into your system or user site-packages in the first place.
Or, if you don't want to pollute your global Python for whatever reason, use a virtualenv.
(While we're at it, it's easier to build things with pip
than to manually find and download the tarballs, expand them, and run the setup.py. But that's a whole other issue.)
Let's say you want to do things this way for some reason. All you need to do is to get numpy onto sys.path
while you're building scipy
. For example:
$ PYTHONPATH="homepath" python setup.py install --home="homepath"
You may want to test this first:
$ PYTHONPATH="homepath" python
>>> import numpy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With