添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Bug summary

When trying to run plt.show the graph isn't being shown and instead the following error is raised:
'NoneType' object has no attribute 'pyplot_show'

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
# from tests import generate_fake_data
x = [i for i in range(10)]# generate_fake_data.generate_time_data()
y = [i for i in range(10)] # list(np.random.rand(10))
fig, ax = plt.subplots()
ax.plot(x, y, linewidth=2.0)
plt.show()

Actual outcome

Matplotlib support failed
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 25, in do_import
succeeded = activate_func()
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_code_executor.py", line 27, in
"matplotlib": lambda: activate_matplotlib(self.enableGui),
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 110, in activate_matplotlib
gui, backend = find_gui_and_backend()
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 47, in find_gui_and_backend
backend = matplotlib.rcParams['backend']
File "C:\Users\jopva\Projects\rws-dataviz\venv\lib\site-packages\matplotlib_ init _.py", line 777, in getitem
plt.switch_backend(rcsetup._auto_backend_sentinel)
File "C:\Users\jopva\Projects\rws-dataviz\venv\lib\site-packages\matplotlib\pyplot.py", line 256, in switch_backend
switch_backend(candidate)
File "C:\Users\jopva\Projects\rws-dataviz\venv\lib\site-packages\matplotlib\pyplot.py", line 337, in switch_backend
backend_mod.show = manager_class.pyplot_show
AttributeError: 'NoneType' object has no attribute 'pyplot_show'

Expected outcome

Show a chart

Additional information

It worked fine on 3.7.0
Downgrading to version 3.7.0 fixes it.

Operating system

Windows 11

Matplotlib Version

3.7.2

Matplotlib Backend

TkAgg

Python version

3.9.6

Jupyter version

No response

Installation

Looking at blame it suggests that #25246 is the offending commit which suggests that this also exists on main and was put in specifically to unbreak pycharm 🤦🏻

Do we have any active contacts at jetbrains? I had some back-channel communication from 2017 that I tried to follow up on so we will see how that goes.