[Matplotlib-users] matplotlib compilation and running issues

Jason Snyder jmssnyder at ucdavis.edu
Thu Sep 17 20:04:31 CEST 2015


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.

Thank you for your time.

-Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20150917/e5b10d54/attachment.html>


More information about the Matplotlib-users mailing list