Website of Daniel A. Mayer

Installing Matplotlib and NumPy in a Virtualenv

Installing NumPy and matplotlib into a virtualenv using Python 2.7 should be an easy task, right? Turns out there are some hoops to jump through in order to make it work properly. Here is what worked for me on my Ubuntu 11.04 (Natty) system.

Installing NumPy

First, remove the system-wide NumPy and matplotlib packages (this might not be necessary though):

sudo apt-get remove python-numpy python-matplotlib

Install the atlas dev files

sudo apt-get install libatlas-base-dev

Apply the quickfix according to:

cd /path/to/virtualenv
mkdir local
ln -s ../lib local/lib

Actually install numpy in the virtualenv

pip -E /path/to/virtualenv install numpy

Installing Matplotlib

There is some problem with the version of matplotlib which is available in PyPi through pip or easy_install. However, when pointing pip directly to the matplotlib tarball, the installation succeeds without a problem.

pip install -E /path/to/virtualenv

I'm sure this last command will require some Ubuntu/Debian developer packages to be installed. My system had everything which was required for the compilation to succeed. Feel free to leave me a comment and I will add a list of prerequisites here.