You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: 'NoneType' object has no attribute 'pyplot_show' #26463
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
importmatplotlib.pyplotaspltimportnumpyasnp# from tests import generate_fake_datax= [iforiinrange(10)]# generate_fake_data.generate_time_data()y= [iforiinrange(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.
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.
This works for me on recent versions of PyCharm (tested with 2022.2.5 and 2023.2.1). It looks like you are still using 2021.1.3. Please update PyCharm and check whether the error persists.
Activity
timhoffm commentedon Aug 7, 2023
Seems you are running from within Pycharm. Does this also happen from the commandline or ipython?
selenecodes commentedon Aug 7, 2023
This also happens in the commandline
jklymak commentedon Aug 7, 2023
Please include the Traceback from the command line error because the Traceback you have given appears to have the problem emanating from pycharm.
tacaswell commentedon Aug 7, 2023
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.
aman3002 commentedon Aug 12, 2023
it works fine
test.txt
timhoffm commentedon Aug 31, 2023
This works for me on recent versions of PyCharm (tested with 2022.2.5 and 2023.2.1). It looks like you are still using 2021.1.3. Please update PyCharm and check whether the error persists.