Keep installation order in freezing piping

Quick question.

Is there a way to ensure that pip freeze > requirements.txt maintains the order in which the packages were installed? This is a problem for me, because I constantly get something like this in requirements.txt :

 matplotlib==1.1.1 numpy==1.6.2 

Therefore, when trying to install using pip install -r requirements.txt an error occurs because numpy is a matplotlib dependency, so you must install numpy manually first and then re-run pip install -r requirements.txt

Are there any corrections on this?

UPDATE In response to mechmind, I installed matplotlib and numpy on Ubuntu 12.04 using pip with virtualenv --distribute myenv. After installation, I received this freeze file:

 argparse==1.2.1 distribute==0.6.28 matplotlib==1.1.1 numpy==1.6.2 wsgiref==0.1.2 

Then, when I try to reinstall in another virtual environment, I get the following error:

 REQUIRED DEPENDENCIES numpy: no * You must install numpy 1.4 or later to build * matplotlib. 

So maybe it depends on the system.

Thanks!

+4
source share
1 answer

Just tried pip with numpy and matplotlib and pip correctly matplotlib dependency checks - first ran numpy. I tried on the old stock from ubuntu 10.10.

EDIT : after playing with pip and virtualenv I realized that dependency checking really only works when these dependencies are detected, that is, when the package was installed, removed and installed again.

Thus, the actual solution will include reordering the packages in the requrements file (for the simple case, when there are only two packages in the wrong order, you can simply cancel the requirements file: sort -r | xargs pip install

0
source

Source: https://habr.com/ru/post/1444511/


All Articles