Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install in order from requirements.txt [duplicate]

I want to install statemodel so i am running

sudo pip install --upgrade -r /srv/requirements.txt

contain of requirements.txt

cat requirements.txt
numpy==1.9.0
scipy==0.14.0
patsy==0.3.0
pandas==0.13.0
statsmodels==0.5.0

but it looks like pip is not installing packages listed in requirements.txt in order because I am getting dependency error like "statsmodels required scipy"

Is there any way to make pip to install packages in the order they have listed in requirements.txt ?

like image 367
roy Avatar asked Oct 16 '25 15:10

roy


1 Answers

You could install using the pip module

import pip
with open("requirements.txt") as f:
    for line in f:
        # call pip's main function with each requirement
        pip.main(['install','-U', line])
like image 96
Padraic Cunningham Avatar answered Oct 18 '25 10:10

Padraic Cunningham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!