I've got a Python package with its setup.py having dependencies declared via the usual way, in install_requires=[...]. One of the packages there, scikits.timeseries, has a setup.py expecting numpy to already be installed, thus, I'd like some way to have numpy installed first. For this case and in general, can the order of dependency installation be controlled? How?
Currently the order in which setup.py pulls down dependencies (as listed in the arg install_requires) seems practically random. Also, in the setup.py setup(...) I tried using the arg:
extras_require={'scikits.timeseries': ['numpy']}
...without success, the order of installing dependencies was unaffected.
I also tried setting up a pip requirements file, but there too, pip's order of installing dependencies didn't match the line-order of the requirements file, so no luck.
Another possibility would be to have a system call near the top of setup.py, to install numpy before the setup(...) call, but I hope there's a better way. Thanks in advance for any help.
Use
setup_requires
parameter, for instance to installnumpy
priorscipy
and__builtins__.__NUMPY_SETUP__ = False
hook to get numpy installed correctly:You can add numpy to setup_requires section:
If
scikits.timeseries
needsnumpy
, then it should declare it as a dependency. If it did, thenpip
would handle things for you (I'm pretty suresetuptools
would, too, but I haven't used it in a long while). If you controlscikits.timeseries
, then you should fix it's dependency declarations.Here's a solution which actually works. It's not an overly "pleasant" method to have to resort to, but "desperate times...".
Basically, you have to:
The drawbacks to this are:
setup.py
in an environment without that.The code: