I need your help about matplotlib. Yes, I did not forget calling the pyplot.show().
$ ipython --pylab
import matplotlib.pyplot as p
p.plot(range(20), range(20))
It returns matplotlib.lines.Line2D at 0xade2b2c
as the output.
p.show()
There is nothing to happen. No error message. No new window. Nothing. I install matplotlib
by using pip and I didn't take any error messages.
Details:
I use,
- Ubuntu
- IPython v0.11
- Python v2.6.6
- matplotlib v1.0.1
I ran into the exact same problem on Ubuntu 12.04, because I installed matplotlib (within a virtualenv) using
To make long story short, my advice is: don't try to install matplotlib using pip or by hand; let a real package manager (e.g. apt-get / synaptic) install it and all its dependencies for you.
Unfortunately, matplotlib's backends (alternative methods for actually rendering your plots) have all sorts of dependencies that pip will not deal with. Even worse, it fails silently; that is,
pip install matplotlib
appears to install matplotlib successfully. But when you try to use it (e.g.pyplot.show()
), no plot window will appear. I tried all the different backends that people on the web suggest (Qt4Agg, GTK, etc.), and they all failed (i.e. when I tried to import matplotlib.pyplot, I getImportError
because it's trying to import some dependency that's missing). I then researched how to install those dependencies, but it just made me want to give up using pip (within virtualenv) as a viable installation solution for any package that has non-Python package dependencies.The whole experience sent me crawling back to apt-get / synaptic (i.e. the Ubuntu package manager) to install software like matplotlib. That worked perfectly. Of course, that means you can only install into your system directories, no virtualenv goodness, and you are stuck with the versions that Ubuntu distributes, which may be way behind the current version...
After running your code include: