Marcos da Silva Sampaio Marcos da Silva Sampaio - 1 year ago 60
Python Question

Matplotlib requirements with pip install in virtualenv

I have a requirements.txt file like this:


When I try
pip install -r requirements.txt
inside a new virtualvenv, I get this:


numpy: no

* You must install numpy 1.1 or later to build

* matplotlib.

If I install numpy first and matplotlib after, it works. However I'd like to keep using
pip install -r requirements.txt
. Is it possible?

bmu bmu
Answer Source

Matplotlib and pip don't seem to play together very well. So I don't think it is possible in this case.

pip first downloads a package listed in your requirements file and than runs, but it doesn't really install it (I'm not quite sure about the internals of pip). After all packages are prepared in this way, they are installed.

The problem is, that matplotlib checks if numpy is installed in its (the check itself is defined in So at the moment the check is performed, numpy is not installed and the matplotlib exits with the error message you received (This may not be a bug, as it may require numpy to build).

This was once addressed in pip issue #24 and issue #25. The issues are closed but give some more details.

What I am doing up to now is to first install numpy and than install all packages from my requirements file.

Update 12/2012

There is a new open pip issue which deals with this problem.

Update 04/2013

The issue is closed as WONTFIX