[Matplotlib-users] matplotlib compilation and running issues

Eric Firing efiring at hawaii.edu
Thu Sep 17 20:17:20 CEST 2015


On 2015/09/17 8:04 AM, Jason Snyder wrote:
> To who it may concern,
>
> I installed matplotlib on my computer and tried to run a program with
> the code below:
>
> import numpy as np
> import matplotlib.pyplot as plt
>
>
> x = np.linspace(0, 10)
> line, = plt.plot(x, np.sin(x), '--', linewidth=2)
>
> When I ran the program I could the below error output:
>
> [vrsops at am-linux-212 cpcharts]$ python line_demo_dash_control.py
> Traceback (most recent call last):
>    File "line_demo_dash_control.py", line 12, in <module>
>      line, = plt.plot(x, np.sin(x), '--', linewidth=2)
>    File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line
> 3092, in plot
>      ax = gca()
>    File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line
> 828, in gca
>      ax =  gcf().gca(**kwargs)
>    File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line
> 462, in gcf
>      return figure()
>    File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line
> 435, in figure
>      **kwargs)
>    File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py",
> line 47, in new_figure_manager
>      return new_figure_manager_given_figure(num, thisFig)
>    File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py",
> line 54, in new_figure_manager_given_figure
>      canvas = FigureCanvasQTAgg(figure)
>    File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py",
> line 72, in __init__
>      FigureCanvasQT.__init__(self, figure)
>    File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt4.py",
> line 68, in __init__
>      _create_qApp()
>    File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_qt5.py",
> line 138, in _create_qApp
>      raise RuntimeError('Invalid DISPLAY variable')
> RuntimeError: Invalid DISPLAY variable
>
> What is causing these errors and how do I resolve this issue?  Also echo
> $DISPLAY is blank.

Are you in a graphical environment, or are you using ssh to connect to 
the machine?  Lack of a DISPLAY variable suggests the latter--no X.

Eric

>
> Thank you for your time.
>
> -Jason
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>



More information about the Matplotlib-users mailing list