I have a headless Ubuntu 14.04 Server that I connect to remotely using SSH. I want to use matplotlib and have plots appear at the ssh client. For example, I would connect using:
ssh -X [email protected]
And then from a Python console, I want this to produce a plot in a window:
import matplotlib.pyplot as plt
plt.plot(range(10))
plt.show()
I have installed matplotlib in my virtualenv, and I ran sudo apt-get install python-gtk2, but the plot still doesn't appear. I assume I'm missing lots of packages. What is a fairly minimal set of X-related packages I could install to make this work? I do NOT want to install ubuntu-desktop.
pip install matplotlib, it doesn't recognize that pygtk is installed. Therefore, the only backend that gets installed is agg. The problem might be that pygtk is installed site-wide rather than in my venv, but I have site packages enabled for this venv. Thus,import pygtkworks fine. But the pip installer doesn't seem to realize I have it installed.setup.cfg.templatetosetup.cfgand edit it accordingly (the file itself has extensive documentation). Also, if it can't build the gtk backend, you'll get more informative errors, instead of just skipping it.