pip - installation of sub-dependencies overrides other packages on requirements.txt

3.4k Views Asked by At

my requirements file is like that :

https://github.com/sontek/pyramid_webassets/archive/38b0b9f9f4e36dc22b3a5c10eabf4d9228d97740.zip#egg=pyramid_webassets-0.0
https://github.com/miracle2k/webassets/archive/334d55c6bcfd091cb2d984777daf943acde0d364.zip#egg=webassets-0.8.dev

when running pip install -r requirements.txt I want it to install the specific version of pyramid_webassets, and then the specific webassets version (0.8.dev)

the problem is that pyramid_webassets have the webassets as sub-dependency, and it installs the latest of this package.

so the output of pip freeze is

Chameleon==2.14
Mako==0.9.1
MarkupSafe==0.18
PasteDeploy==1.5.2
WebOb==1.3.1
argparse==1.2.1
pyramid==1.4.5
pyramid-webassets==0.0
repoze.lru==0.6
translationstring==1.1
venusian==1.0a8
webassets==0.9
wsgiref==0.1.2
zope.deprecation==4.1.0
zope.interface==4.0.5

you might notice that webassets version is the latest (0.9) though I specified the version I want (0.8.dev).

I tried to reorder the list, adding the --upgrade flag- nothing helped.

any idea how can I install it and still having the required version of webassets?

Thanks.


soultion:

I found this commend useful:

cat requirements.txt | xargs -L1 pip install

that will install one by one the packages orderly

but we should add --upgrade for the last package so it'll upgrade it.

2

There are 2 best solutions below

2
On

use pip install option to not install package dependencies

$ pip install --no-deps -r requirements.txt 

Doing a pip freeze afterwards

gottfried@sascha-Latitude-XT2:~/venv$ bin/pip freeze
argparse==1.2.1
pyramid-webassets==0.0
webassets==0.8.dev
wsgiref==0.1.2

References

1
On

What happens when you move webassets higher then pyramid_webassets on the list?