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
interactive plot window not showing under wayland in debug mode for matplotlib=3.9 #1633
If the break point is at pass, where Debugger skipped entering the interactive mode, the figure is shown normally.
But if there are break points earlier, e.g., add a break point at plt.plot..., then debug and go though until we stop at pass,
the figure won't be shown, with a wayland icon/window showing in the taskbar, but an invisible figure window.
Turing on interactive mode manually makes the plot invisible too (set break point at pass and debug):
Don't know if this is wayland specific, or also affect X11 (not tested). But note that under wayland, there exists a warning: qt.qpa.wayland: Wayland does not support QWindow::requestActivate() when plt.show().
Reacted by Stylianos Bitzas, Claudius Haag and mariuswallraff
Thank you for the proposed fix, sadly it did not help for me. I could not notice any differences (and I verified that I modified the correct file; raising a ValueError led to the expected result).
This issue should be fixed in the latest build of debugpy. It should ship with VS code in a future version of the Python Debugger Extension or you can install your own debugpy from pypi
Thank you! I can confirm that plots created in a python file (BEFORE hitting a breakpoint and entering debug mode) are appearing and interacting normally. However, I am still not able to create plots from the VSCode Debug Console like I have been able to in previous versions of python/debugpy. The behavior is the same as what's described in the issue - an empty figure window and wayland appears but is "Not responding" and requires terminating python to unfreeze.
Steps to reproduce
import matplotlib.pyplot as plt
x = [0, 1]
y = [0, 2]
pass
Place breakpoint on pass, then in the VSCode Debug Console try to plot plt.plot(x, y)
Attempts to use plt.show(), plt.figure(), plt.ion() did not work
Ah, gotcha. I had simply updated the debugpy dependency in my project env (using poetry).
I now have replaced the %USERPROFILE%\.vscode\extensions\ms-python.debugpy-2024.14.0-win32-x64\bundled\libs\debugpy\ directory with the package that had gotten installed in my project env and everything seems to be working well. Thanks again!
I tried to replicate this solution on VSCode on Ubuntu 20.04
I replaced the debugpy in the extension folder to 1.8.12 here: ~/.vscode/extensions/ms-python.debugpy-2024.14.0-linux-x64/bundled/libs/debugpy
I made sure it uses it by printing the module path and version while in debug mode:
Hey, I know the label still says Fixed in next release, but that was in January and I'm on ms-python.debugpy 2025.4.0 now, using debugpy 1.8.12 in the extensions folder.
When I do a plt.show() before my first plt.plot invocation, I get
Backend tkagg is interactive backend. Turning interactive mode on.
as you said and everything works fine afterwards, especially plotting after hitting breakpoints.
If however I have a breakpoint before the first show, I get this instead, and the old problem persists, i.e., the interactive-plot window opens, but remains white and unresponsive.
Failed to enable GUI event loop integration for 'qt'
Traceback (most recent call last):
File "c:\Users\MariusWallraff.vscode\extensions\ms-python.debugpy-2025.4.0-win32-x64\bundled\libs\debugpy_vendored\pydevd\pydev_ipython\matplotlibtools.py", line 49, in do_enable_gui
enable_gui(guiname)
File "c:\Users\MariusWallraff.vscode\extensions\ms-python.debugpy-2025.4.0-win32-x64\bundled\libs\debugpy_vendored\pydevd\pydev_ipython\inputhook.py", line 567, in enable_gui
return gui_hook(app)
^^^^^^^^^^^^^
File "c:\Users\MariusWallraff.vscode\extensions\ms-python.debugpy-2025.4.0-win32-x64\bundled\libs\debugpy_vendored\pydevd\pydev_ipython\inputhook.py", line 187, in enable_qt
self.enable_qt4(app)
File "c:\Users\MariusWallraff.vscode\extensions\ms-python.debugpy-2025.4.0-win32-x64\bundled\libs\debugpy_vendored\pydevd\pydev_ipython\inputhook.py", line 213, in enable_qt4
app, inputhook_qt4 = create_inputhook_qt4(self, app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\MariusWallraff.vscode\extensions\ms-python.debugpy-2025.4.0-win32-x64\bundled\libs\debugpy_vendored\pydevd\pydev_ipython\inputhookqt4.py", line 87, in create_inputhook_qt4
app = QtGui.QApplication([" "])
^^^^^^^^^^^^^^^^^^
AttributeError: module 'PySide6.QtGui' has no attribute 'QApplication'. Did you mean: 'QGuiApplication'?
Backend qtagg is interactive backend. Turning interactive mode on.
I suppose debugpy might fail to detect the correct version of QT in my environment, which is qt6?
I'm using the most recent stable version of matplotlib, 3.10.1.
Activity
rchiodo commentedon Jul 22, 2024
There's specific code in pydevd (the base of debugpy) that likely is out of date with matplotlib: https://github.com/fabioz/PyDev.Debugger/blob/54f8db469c2d8c31635db7cc59a10bc8dab76057/pydevd.py#L695
jcjaskula-aws commentedon Sep 15, 2024
Proposed this fix: fabioz/PyDev.Debugger#289. Curious to know if it solves most of the issues listed here.
mariuswallraff commentedon Oct 2, 2024
Thank you for the proposed fix, sadly it did not help for me. I could not notice any differences (and I verified that I modified the correct file; raising a ValueError led to the expected result).
planted-jason-hoving commentedon Dec 20, 2024
same issue here. any updated guidance on how to fix?
I am using python 3.12.1 with up-to-date VS Code for windows, and updated to the latest debugpy 1.8.11
rchiodo commentedon Dec 20, 2024
There's likely a need to update the matplotlib code that pydevd has. This code here:
https://github.com/fabioz/PyDev.Debugger/blob/d0f81de46ec51687ac24ae9598eb2615010a4b44/pydev_ipython/matplotlibtools.py#L93
dangpzanco commentedon Jan 9, 2025
I had this same issue with Matplotlib >=3.9 on VSCode debug mode for multiple Python versions.
Running
matplotlib.use("QtAgg")before plotting fixed the issue.It seems to be a problem with the debuggers not interacting correctly with matplotlib anymore, see: matplotlib/matplotlib#28449 (comment)
rchiodo commentedon Jan 15, 2025
This issue should be fixed in the latest build of debugpy. It should ship with VS code in a future version of the Python Debugger Extension or you can install your own debugpy from pypi
rchiodo commentedon Jan 15, 2025
Take that back, our release to PyPI failed when it looked like it succeeded. Fix will be coming after we resolve that problem.
rchiodo commentedon Jan 16, 2025
PyPI release succeeded. v1.8.12 is now available
planted-jason-hoving commentedon Jan 16, 2025
Thank you! I can confirm that plots created in a python file (BEFORE hitting a breakpoint and entering debug mode) are appearing and interacting normally. However, I am still not able to create plots from the VSCode Debug Console like I have been able to in previous versions of python/debugpy. The behavior is the same as what's described in the issue - an empty figure window and wayland appears but is "Not responding" and requires terminating python to unfreeze.
Steps to reproduce
Place breakpoint on pass, then in the VSCode Debug Console try to plot
plt.plot(x, y)Attempts to use
plt.show(),plt.figure(),plt.ion()did not workrchiodo commentedon Jan 16, 2025
How did you update the debugger used by vscode? This fix isn't in VS code yet, you'd have to manually copy debugpy into the extension folder.
rchiodo commentedon Jan 16, 2025
That works for me inside VS code if I manually update the bits it uses.
planted-jason-hoving commentedon Jan 16, 2025
Ah, gotcha. I had simply updated the debugpy dependency in my project env (using poetry).
I now have replaced the
%USERPROFILE%\.vscode\extensions\ms-python.debugpy-2024.14.0-win32-x64\bundled\libs\debugpy\directory with the package that had gotten installed in my project env and everything seems to be working well. Thanks again!yamichael commentedon Jan 20, 2025
I tried to replicate this solution on VSCode on Ubuntu 20.04
I replaced the debugpy in the extension folder to 1.8.12 here:
~/.vscode/extensions/ms-python.debugpy-2024.14.0-linux-x64/bundled/libs/debugpyI made sure it uses it by printing the module path and version while in debug mode:
while on breakpoint on
pass, I am still unable to plot graphs in interactive mode.Did I miss anything?
rchiodo commentedon Jan 21, 2025
That sounds like it should work. It should print out something like this on the command line:
If that didn't happen, then debugpy didn't detect matplotlib being used. Your exact code works fine for me. I just do this in the debug console:
mariuswallraff commentedon Mar 7, 2025
Hey, I know the label still says
Fixed in next release, but that was in January and I'm onms-python.debugpy 2025.4.0now, usingdebugpy 1.8.12in the extensions folder.When I do a
plt.show()before my firstplt.plotinvocation, I getas you said and everything works fine afterwards, especially plotting after hitting breakpoints.
If however I have a breakpoint before the first
show, I get this instead, and the old problem persists, i.e., the interactive-plot window opens, but remains white and unresponsive.I suppose
debugpymight fail to detect the correct version of QT in my environment, which is qt6?I'm using the most recent stable version of matplotlib,
3.10.1.rchiodo commentedon Mar 7, 2025
mariuswallraff yeah it looks like it's detecting pyqt4 instead of qt6. Probably some issue with the inputhook here:
debugpy/src/debugpy/_vendored/pydevd/pydev_ipython/inputhook.py
Line 182 in 96de437
fix(deps): update backend dependencies (patch) (patch)
Merge branch 'renovate/patch-backend-dependencies' into 'main'