python - How to handle dependency on scipy in setup.py -


i trying create setup.py project depends on scipy. following setup.py reproduces this:

setup(     name='test',     version='0.1',     install_requires=['scipy'] ) 

when installing using python setup.py develop generates following error:

importerror: no module named numpy.distutils.core 

however, when install scipy using pip, installed wheel, , works fine.

so, questions is, how can create setup.py depends on scipy? why won't setuptools install dependencies wheels? work better when using python 3 (we plan migrate anyway, if works there, i'll wait until migration complete).

i using python 2.7.8 on mac os x 10.10.1 setuptools 3.6 , pip 1.5.6.

ultimately, worked me:

#!/usr/bin/env python  setuptools import setup, extension setuptools.command.build_ext import build_ext _build_ext  # # cludge necessary horrible reasons: see comment below , # http://stackoverflow.com/q/19919905/447288 # class build_ext(_build_ext):     def finalize_options(self):         _build_ext.finalize_options(self)         # prevent numpy thinking still in setup process:         __builtins__.__numpy_setup__ = false         import numpy         self.include_dirs.append(numpy.get_include())  setup(     #     # amazingly, `pip install scipy` fails if `numpy` not installed.     # since cannot control order dependencies installed via     # `install_requires`, use `setup_requires` ensure `numpy` available     # before `scipy` installed.     #     # unfortunately, *still* not sufficient: `numpy` has guard     # check when in setup process must circumvent     # `cmdclass`.     #     setup_requires=['numpy'],     cmdclass={'build_ext':build_ext},     install_requires=[         'numpy',         'scipy',     ],     ... ) 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -