I am running python code on a linux machine through a putty ssh from a windows machine.

I need to run the following commands:

matplotlib.pylot.savfig("some figure.png")

Nothing actually gets displayed, but the python code apparently checks to see that the display variable is set. Anyhow, the display variable is invalid and has nowhere to go.

I did what I usually do when ssh'ing from a linux box:

export DISPLAY=:0.0

But then I ran into an issue with the X-server. So I enabled X11 forwarding through putty.

Then, I ran into the issue that there is no X-server on Windows...

Is there a way I can just bypass this and get the data to save?

(or I guess set up an X-server and redirect the display) (Have installed Xming, and am running it...but that is as far as I've gotten...I still haven't managed to export the display to the X server...)

  • Have you considered running a VNC server on the Linux machine, and a VNC client on the Windows machine? This, linuxtopia.org/HowToGuides/VNC_setup_Linux_Windows.html is a very nice and complete summary of ll the steps necessary. Remember you can even launch a whole copy of your Linux desktop environment (Gnome, KDE, whatever....) to be displayed on your Windows pc. – MariusMatutiae Dec 8 '15 at 22:20
  • awesome. I will set that up. I just need to graph about 4hrs worth of high performance processing before midnight (when the assignment is due)... – donlan Dec 8 '15 at 22:30

As described by this question and this question, you can configure pyplot to not try to use the display:

import matplotlib
# Force matplotlib to not use any Xwindows backend.
  • Got it. at least that will work for now. Thank you. – donlan Dec 8 '15 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.