0

Trying

import matplotlib.pyplot as plt
fig = plt.figure()

yields

Traceback (most recent call last): File "", line 1, in File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 423, in figure **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in new_figure_manager return new_figure_manager_given_figure(num, figure) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 87, in new_figure_manager_given_figure window = Tk.Tk() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in init self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable

Never encountered this error before. Right now I'm on a windows machine (at home) accessing a ubuntu machine (at work) via ssh. Could this be the reason for the error? matplotlib is of course completely installed on the ubuntu machine at work.

rtime
  • 349
  • 6
  • 23
  • just to clarify: Do you run the code on ubuntu or does the ssh connection is part of the program? – Glostas Oct 14 '15 at 08:55
  • I run the code on ubuntu. I connect via ssh -Y 'mylogin' and then run /usr/bin/python 'mypythonfile.py' – rtime Oct 14 '15 at 08:57
  • Than I do not think it is a problem with the ssh... – Glostas Oct 14 '15 at 09:04
  • I went nuts about this error and drove to work to test it. There, my code worked just fine. I tried 'import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt' which was suggested [link](http://stackoverflow.com/questions/4931376/generating-matplotlib-graphs-without-a-running-x-server) here, but it didn't work neither. – rtime Oct 14 '15 at 12:54

0 Answers0