Installing MatPlotLib on OS X for Python Version 2.6.1 with PIP and VirtualEnv

If you thought you had installed matplotlib only to find this

File "/Library/Python/2.6/site-packages/matplotlib-0.91.1-py2.6-macosx-10.6-universal.egg/matplotlib/numerix/__init__.py", line 166, in
__import__('ma', g, l)
File "/Library/Python/2.6/site-packages/matplotlib-0.91.1-py2.6-macosx-10.6-universal.egg/matplotlib/numerix/ma/__init__.py", line 16, in
from numpy.core.ma import *
ImportError: No module named ma

It is because the package being installed is version 0.91 and you need at least version 1.0 .

If it’s already installed pass pip the upgrade flag and specify the package location with the “-f” flag

pip install --upgrade -f http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0/matplotlib-1.0.0.tar.gz matplotlib

If not installed

pip install -f http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0/matplotlib-1.0.0.tar.gz matplotlib

Resources:

http://stackoverflow.com/questions/3555551/why-does-pip-install-matplotlib-version-0-91-1-when-pypi-shows-version-1-0-0