PyCharm and matplotlib: not responding
已回答
This is a recurring problem that I have had with PyCharm. When trying to display plots with `plt.show()` a black window opens and is not responding. I can only close it. Usually, using `matplotlib.use("qt5agg")` would fix the problem but it seems to no longer be the case. I really don't know what to do.
I run the Professional edition on Ubuntu 20.04, all my python packages are up to date.
帖子评论已关闭。
Which PyCharm version are you running? Also, share a quick example if possible. I just tried with the following example on 2024.3.5 with matplotlib 3.10.1
And it worked normally;
I use matplotlib 3.10.0.
I provide you with 2 code examples:
What happens ?
If I uncomment
# use("Qt5Agg"), I get what I want, second screenshot.I hope it is clearer, let me know if I can provide more information! Thank you for your help.
I was unable to replicate the same behavior on both cases:
Please try the 2025.1 EAP available via the Toolbox App; Make sure to create a brand new project with a new interpreter just in case;
In case it persists, please create a new bug report on YouTrack and make sure to provide the IDE UI logs from Help | Collect Logs and Diagnostic Data
I have the same issue with Pycharm 2024.3.2 (Professional Edition) Build #PY-243.23654.177
Runtime version: 21.0.5+8-b631.30 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
and matplotlib 3.9.2
As the user above usually setting to “Qt5Agg” will fix the issue but it no longer is for some reason. Note this is for interactive plots that do not use the scientific viewer.
Is pycharm just not supporting interactive plots anymore? Any other tips on consistently getting interactive plots to render in pycharm?
Edit: For others in a similar situation - I had to import matplotlib, set it to use tkagg, then set it to use qt5agg to get it working again. Using qt5agg as the default/ at the start did not work for me, and of course if you are facing this tkagg also does not work.
Hi Jangst, this issue requires thorough investigation, please create an issue on YouTrack and attach all relevant information for quicker resolution