pip freeze and order of dependencies

pip, python

Solution

For your case it does not matter, because `pip` builds every requirements (calling `python setup.py egg_info` for each) and then install them all. For your specific case, it does not matter, because `numpy` is currently required to be installed while building `matplotlib`.

It is a problem with `matplotlib`, and they created a proposal to fix it: https://github.com/matplotlib/matplotlib/wiki/MEP11

See comments from this issue at pip issue tracker: https://github.com/pypa/pip/issues/25

This question is a duplicate of Matplotlib requirements with pip install in virtualenv.

Problem

``` `pip freeze > requirements.txt` ``` automatically writes my dependencies in an apparently alphabetically order, like this:- ``` matplotlib==1.2.0 numpy==1.6.2 pandas==0.9.1 ``` The problem with this is that `pip install -r requirements.txt` (when I deploy my code with its dependencies listed in `requirements.txt`) will end up failing because matplotlib needs numpy to be installed first. How can I ensure that matplotlib is listed after numpy in the `requirements.txt` file when I `pip freeze` it?

Original source