I am having difficulties importing matplotlib.pyplot
when I am using ssh to access my local lab cluster.
Indeed, trying to import matplotlib.pyplot as plt
is giving me an error. I have tried to just import matplotlib as mpl
and this is fine, so something specifically about importing pyplot
is wrong here. The last line of the trace-back says
File '/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk3.py',
line 58, in <module>
cursors.MOVE : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
TypeError: constructor returned NULL
Can anyone identify the error here? Or, is there a way I can circumvent the error and still use the pyplot
tools?
If it makes a difference, I am using Windows 8.
You are failing to load GTK. Most likely, it is because you do not have access to an X11 server and can't draw windows (which is what GTK does).
Try matplotlib.use("Pdf")
before importing pyplot
. Then you won't need to load GTK and it won't fail. You can still make plots and save them to pdf but you can't draw them on screen.
Alternatively, you could try forwarding X11. Then you could see the windows as if you were on the host machine. With a Linux client, this is done by logging on via ssh -X hostname
. With a Windows client, it can be done but not as smoothly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With