python - Using matplotlib on headless Ubuntu 14.04 Server -
i have headless ubuntu 14.04 server connect remotely using ssh. want utilize matplotlib , have plots appear @ ssh client. example, connect using:
ssh -x name@server.com
and python console, want produce plot in window:
import matplotlib.pyplot plt plt.plot(range(10)) plt.show()
i have installed matplotlib in virtualenv, , ran sudo apt-get install python-gtk2
, plot still doesn't appear. assume i'm missing lots of packages. minimal set of x-related packages install create work? not want install ubuntu-desktop
.
i got working on ubuntu 14.04.1 server, painful! tricky part virtualenv. had luck using qt4 backend, able install via ubuntu bundle , had symlink virtualenv. here's step-by-step process...
first install pre-reqs , hack pyqt4 virtualenv:
$ sudo apt-get install xauth x11-apps python-qt4 $ ln -s /usr/lib/python2.7/dist-packages/pyqt4 /path/to/myvenv/lib/python2.7/pyqt4
now manually download , install sip (http://www.riverbankcomputing.com/software/sip/intro) venv activated, follows:
$ tar xzf sip-4.16.4.tar.gz $ cd sip-4.16.4 $ python configure.py $ create $ sudo create install
next, download matplotlib source tarball , modify setup configuration forcefulness install qt4 backend:
$ tar xzf matplotlib-1.4.2.tar.gz $ cp matplotlib-1.4.2/setup.cfg.template matplotlib-1.4.2/setup.cfg
now edit setup.cfg
near line 68 read:
qt4agg = true
matplotlib install cleanly in venv:
$ pip install -e matplotlib-1.4.2/
now can ssh using -x
flag , plots load remotely!
python ubuntu ssh matplotlib
No comments:
Post a Comment