Wednesday, February 27, 2013

pip install numpy and scipy together

    While working for a new python module at +Salford Systems, I've discovered an issue if you run command like this:
 pip install numpy scipy 
 ".tox/py25/build/scipy/", line 131, in setup_package from numpy.distutils.core import setup  ImportError: No module named numpy.distutils.core 
    Same issue will appear if numpy and scipy modules are listed in requirements.txt and you will try to install it as:
pip install -r requirements.txt 
 The origin of issue is that in scipy is using numpy.distrutils.core.setup and doesn't want to work with it, but pip actually queries with egg_info before installing anything. This is done to prevent installing broken packages and leaving half-installed state. Instead it checks first that everything fine and only then starts to install them.

     Now, I've made my our branch of scipy on github and fixed this by making whitelist of commands that are able to work without numpy importing. This allows to run listed above examples without issues.
     Pending pull-request to master of scipy is here -

     PS. Related issues on a web: