Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Invalid DISPLAY variable #58

Closed
juls858 opened this issue Oct 31, 2015 · 7 comments
Closed

RuntimeError: Invalid DISPLAY variable #58

juls858 opened this issue Oct 31, 2015 · 7 comments

Comments

@juls858
Copy link

juls858 commented Oct 31, 2015

Can't get any plots to work!

RuntimeError Traceback (most recent call last)
in ()
----> 1 merged.loc[:,["GDPC1","INDPRO","UNRATE"]].plot()

/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in plot_frame(data, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, *_kwds)
2486 yerr=yerr, xerr=xerr,
2487 secondary_y=secondary_y, sort_columns=sort_columns,
-> 2488 *_kwds)
2489
2490

/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in _plot(data, x, y, subplots, ax, kind, *_kwds)
2322 plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, *_kwds)
2323
-> 2324 plot_obj.generate()
2325 plot_obj.draw()
2326 return plot_obj.result

/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in generate(self)
911 self._args_adjust()
912 self._compute_plot_data()
--> 913 self._setup_subplots()
914 self._make_plot()
915 self._add_table()

/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/tools/plotting.pyc in _setup_subplots(self)
958 else:
959 if self.ax is None:
--> 960 fig = self.plt.figure(figsize=self.figsize)
961 axes = fig.add_subplot(111)
962 else:

/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, *_kwargs)
433 frameon=frameon,
434 FigureClass=FigureClass,
--> 435 *_kwargs)
436
437 if figLabel:

/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager(num, _args, *_kwargs)
45 FigureClass = kwargs.pop('FigureClass', Figure)
46 thisFig = FigureClass(_args, *_kwargs)
---> 47 return new_figure_manager_given_figure(num, thisFig)
48
49

/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager_given_figure(num, figure)
52 Create a new figure manager instance for the given figure.
53 """
---> 54 canvas = FigureCanvasQTAgg(figure)
55 return FigureManagerQT(canvas, num)
56

/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in init(self, figure)
70 if DEBUG:
71 print('FigureCanvasQtAgg: ', figure)
---> 72 FigureCanvasQT.init(self, figure)
73 FigureCanvasAgg.init(self, figure)
74 self._drawRect = None

/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.pyc in init(self, figure)
66 if DEBUG:
67 print('FigureCanvasQt qt4: ', figure)
---> 68 _create_qApp()
69
70 # Note different super-calling style to backend_qt5

/opt/conda/envs/python2/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.pyc in _create_qApp()
136 display = os.environ.get('DISPLAY')
137 if display is None or not re.search(':\d', display):
--> 138 raise RuntimeError('Invalid DISPLAY variable')
139
140 qApp = QtWidgets.QApplication([str(" ")])

RuntimeError: Invalid DISPLAY variable

@parente
Copy link
Member

parente commented Nov 1, 2015

Does the magic %matplotlib inline fix it in the notebook?

@juls858
Copy link
Author

juls858 commented Nov 1, 2015

thanks! that fixed it!

On Sat, Oct 31, 2015 at 6:34 PM, Peter Parente notifications@github.com
wrote:

Does the magic %matplotlib inline fix it in the notebook?


Reply to this email directly or view it on GitHub
#58 (comment)
.

@dhuanca
Copy link

dhuanca commented Jan 28, 2016

really works! thank you! -.-'

@francica
Copy link

francica commented Aug 4, 2016

where should I run %matplotlib inline?
In bash? or in the py file?

thanks

@parente
Copy link
Member

parente commented Aug 4, 2016

The latest images should automatically default to the inline matplotlib backend. docker pull to get the latest if you haven't recently.

@lohetvr
Copy link

lohetvr commented Sep 30, 2016

I face the same problem too despite using
%matplotlib inline #plots it on the notebook itself

The error message for the code is as follows:

RuntimeError Traceback (most recent call last)
in ()
----> 1 print plt.plot(test_data['sqft_living'],test_data['price'],'.',test_data['sqft_living'],sqft_model.predict(test_data),'-')

/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in plot(_args, *_kwargs)
3145 @_autogen_docstring(Axes.plot)
3146 def plot(_args, *_kwargs):
-> 3147 ax = gca()
3148 # allow callers to override the hold state by passing hold=True|False
3149 washold = ax.ishold()

/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in gca(**kwargs)
926 matplotlib.figure.Figure.gca : The figure's gca method.
927 """
--> 928 return gcf().gca(**kwargs)
929
930 # More ways of creating axes:

/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in gcf()
576 return figManager.canvas.figure
577 else:
--> 578 return figure()
579
580

/opt/conda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, *_kwargs)
525 frameon=frameon,
526 FigureClass=FigureClass,
--> 527 *_kwargs)
528
529 if figLabel:

/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager(num, _args, *_kwargs)
44 FigureClass = kwargs.pop('FigureClass', Figure)
45 thisFig = FigureClass(_args, *_kwargs)
---> 46 return new_figure_manager_given_figure(num, thisFig)
47
48

/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in new_figure_manager_given_figure(num, figure)
51 Create a new figure manager instance for the given figure.
52 """
---> 53 canvas = FigureCanvasQTAgg(figure)
54 return FigureManagerQT(canvas, num)
55

/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in init(self, figure)
74 if DEBUG:
75 print('FigureCanvasQtAgg: ', figure)
---> 76 FigureCanvasQT.init(self, figure)
77 FigureCanvasQTAggBase.init(self, figure)
78 FigureCanvasAgg.init(self, figure)

/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.pyc in init(self, figure)
66 if DEBUG:
67 print('FigureCanvasQt qt4: ', figure)
---> 68 _create_qApp()
69
70 # Note different super-calling style to backend_qt5

/opt/conda/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.pyc in _create_qApp()
136 display = os.environ.get('DISPLAY')
137 if display is None or not re.search(':\d', display):
--> 138 raise RuntimeError('Invalid DISPLAY variable')
139
140 qApp = QtWidgets.QApplication([str(" ")])

RuntimeError: Invalid DISPLAY variable

I am new to programming and I am learning as much as I can through the internet, any help would be much appreciated as this is hindering my progress!

rochaporto pushed a commit to rochaporto/docker-stacks that referenced this issue Jan 23, 2019
@kampandi
Copy link

Thanks, it works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants