pythonpipvirtualenvrequirements.txt

How to specify install order for python pip?


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.


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.

    #!/bin/bash
    for line in $(cat requirements.txt)
    do
      pip install $line -E /path/to/virtualenv
    done