I'm working with fabric(0.9.4)+pip(0.8.2) and I need to install some python modules for multiple servers. All servers have old version of setuptools (0.6c8) which needs to be upgraded for pymongo module. Pymongo requires setuptools>=0.6c9.
My problem is that pip starts installation with pymongo instead of setuptools which causes pip to stop. Shuffling module order in requirements file doesn't seem to help.
requirements.txt:
setuptools>=0.6c9
pymongo==1.9
simplejson==2.1.3
Is there a way to specify install order for pip as it doesn't seem to do it properly by itself?
This can be resolved with two separate requirements files but it would be nice if I didn't need to maintain multiple requirements files now or in the future.
Problem persists with pip 0.8.3.
Following on from @lukasrms's solution - I had to do this to get pip to install my requirements one-at-a-time:
Sadly the upgrade suggestion won't work. If you read the other details in https://github.com/pypa/pip/issues/24 you will see why
pip will build all packages first, before attempting to install them. So with a requirements file like the following
The build of statsmodels will fail with the following statement
The workaround given for manually calling pip for each entry in the requirements file (via a shell script) seems to be the only current solution.
This is a silly hack, but might just work. Write a bash script that reads from your requirements file line by line and runs the pip command on it.
How do you know? Requires to build or to install? You don't say what version of Pymongo you were trying to install but looking at
setup.py
file for current (3.2.2) version there's no specification of neither what Pymongo requires to runsetup.py
(setup_requires
) nor what it requires to install (install_requires
). With no such information pip can't ensure specific version of setuptools. If Pymongo requires specific version of setuptools to run itssetup.py
(as opposed to requiring setuptools to runsetup
function itself) then the other problem is that until recently there was no way to specify this. Now there's specification – PEP 518 – Specifying Minimum Build System Requirements for Python Projects, which should be shortly implemented in pip – Implement PEP 518 support #3691.As to order of installation, this was fixed in pip 6.1.0;
From pip install – Installation Order section of pip's documentation:
And later:
However, without proper specification of requirements by Pymongo it won't help either.
You can just use:
To allow all types of entries (for example packages from git repositories) in requirements.txt you need to use the following set of commands
-n 1 and -L 1 options are necessary to install packages one by one and treat every line in the requirements.txt file as a separate item.