I love matplotlib because it allowed me to move away from Matlab to Python as my platform of choice for quick problem solving. It is a very good plotting library. During my previous post on installing JModelica, I mentioned that matplotlib is failing. I recompiled a lot of stuff and finally thought I had it all licked (some of the problems had to do with gfortran not doing 64 bit code by default). Then I ran ipython, and import pylab fails. Strange, considering that import matplotlib works fine. Even stranger, ipython -pylab works fine, too.
In [1]: import pylab
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Users/alchemyst/tmp/ in ()
/Library/Python/2.6/site-packages/pylab.py in ()
----> 1 from matplotlib.pylab import *
2 import matplotlib.pylab
3 __doc__ = matplotlib.pylab.__doc__
ImportError: No module named pylab
After some very frustrating searching around and reading of forum posts, it finally dawns on me that I am in my tmp directory, where the matplotlib directory I built it is still around. So that’s what’s happening! import matplotlib is importing the module from this directory. There is no pylab module there, so it’s giving the error. Hopefully someone experiencing similar problems may find some help in this post.