In case matplotlib is installed, but poorly configured for your
current situation. For example, if you've SSHed into a host without
tunneling X, you can see:
$ python -c 'import matplotlib.pyplot'
/usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57:
GtkWarning: could not open display
...
RuntimeError: could not create GdkCursor object
try:
from matplotlib import pyplot
from numpy import loadtxt
-except ImportError, e:
+except (ImportError,RuntimeError), e:
pyplot = None
loadtxt = None
plot_import_error = e