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

something wrong in matplotlib #139

Open
FYYFU opened this issue Jan 17, 2021 · 2 comments
Open

something wrong in matplotlib #139

FYYFU opened this issue Jan 17, 2021 · 2 comments

Comments

@FYYFU
Copy link

FYYFU commented Jan 17, 2021

The file is in Link.
ERROR:
RuntimeError: Invalid DISPLAY variable

The code:

matplotlib.use('Agg')

might be set before code:

import matplotlib.pyplot as plt

@rohitdavas
Copy link

Can you please post full traceback .

@FYYFU
Copy link
Author

FYYFU commented Jan 17, 2021

Can you please post full traceback .

Error:
gambler_problem.py:4: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was originally set to 'Qt5Agg' by the following code:
File "gambler_problem.py", line 2, in
import matplotlib.pyplot as plt
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 71, in
from matplotlib.backends import pylab_setup
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/backends/init.py", line 16, in
line for line in traceback.format_stack()

matplotlib.use('Agg')
Traceback (most recent call last):
File "gambler_problem.py", line 77, in
figure_4_3()
File "gambler_problem.py", line 59, in figure_4_3
plt.figure(figsize=(10, 20))
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 533, in figure
**kwargs)
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 167, in new_figure_manager_given_figure
canvas = cls.FigureCanvas(figure)
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 24, in init
super(FigureCanvasQTAgg, self).init(figure=figure)
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5.py", line 234, in init
_create_qApp()
File "/home/yuf/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5.py", line 125, in _create_qApp
raise RuntimeError('Invalid DISPLAY variable')
RuntimeError: Invalid DISPLAY variable

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

2 participants