How to specify install order for python pip?

后端 未结 9 1455
[愿得一人]
[愿得一人] 2020-11-30 02:22

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

相关标签:
9条回答
  • 2020-11-30 02:56

    I ended up running pip inside virtualenv instead of using "pip -E" because with -E pip could still see servers site-packages and that obviously messed up some of the installs.

    I also had trouble with servers without virtualenvs. Even if I installed setuptools with separate pip command pymongo would refuse to be installed.

    I resolved this by installing setuptools separately with easy_install as this seems to be problem between pip and setuptools.

    snippets from fabfile.py:

    env.activate = "source %s/bin/activate" % virtualenv_path
    
    _virtualenv("easy_install -U setuptools")
    _virtualenv("pip install -r requirements.txt")
    
    def _virtualenv(command)
        if env.virtualenv:
            sudo(env.activate + "&&" + command)
        else:
            sudo(command)
    

    I had these problems with pip 0.8.3 and 0.8.2.

    0 讨论(0)
  • 2020-11-30 02:57

    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
    
    0 讨论(0)
  • 2020-11-30 03:02

    To allow all types of entries (for example packages from git repositories) in requirements.txt you need to use the following set of commands

    cat requirements.txt | xargs -n 1 -L 1 pip install
    

    -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.

    0 讨论(0)
提交回复
热议问题