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
Open VS Code, create a file, enter the following content
importmatplotlib.pyplotasplt# <-- put a breakpoint hereraiseValueError("I should get here")
Put the breakpoint, start debugging, step over.
Additional information
It seems removing either of matplotlib, jupyter or PyQt6 solves the problem.
Installing an older version of the Python extension (ms-python.python) also works. v2022.4.1 was the first that caused the issue, while the previous (previous according to VS Code) v2022.2.1924087327 still works.
I could capture the behavior in the following video: screencast.webm
import faulthandler
faulthandler.enable()
import matplotlib.pyplot as plt
raise ValueError("I should get here")
Stack trace
cd /tmp/mydebug/src ; /usr/bin/env /home/battleman/anaconda3/envs/bug-report/bin/python /home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 40627 -- main.py
Fatal Python error: Segmentation fault
Thread 0x00007f6c86ffd640 (most recent call first):
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 316 in wait
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 581 in wait
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 261 in _on_run
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 49 in run
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 980 in _bootstrap_inner
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 937 in _bootstrap
Thread 0x00007f6c877fe640 (most recent call first):
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 316 in wait
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 581 in wait
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 215 in _on_run
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 49 in run
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 980 in _bootstrap_inner
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 937 in _bootstrap
Thread 0x00007f6c87fff640 (most recent call first):
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 312 in wait
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 581 in wait
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_timeout.py", line 43 in _on_run
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 49 in run
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 980 in _bootstrap_inner
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 937 in _bootstrap
Thread 0x00007f6c8cf3e640 (most recent call first):
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 204 in _read_line
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 222 in _on_run
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 49 in run
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 980 in _bootstrap_inner
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 937 in _bootstrap
Thread 0x00007f6c8d73f640 (most recent call first):
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 316 in wait
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/queue.py", line 180 in get
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 367 in _on_run
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py", line 49 in run
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 980 in _bootstrap_inner
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/threading.py", line 937 in _bootstrap
Current thread 0x00007f6c903b5440 (most recent call first):
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/inputhookqt5.py", line 88 in create_inputhook_qt5
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/inputhook.py", line 224 in enable_qt5
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/inputhook.py", line 178 in enable_qt
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/inputhook.py", line 540 in enable_gui
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py", line 30 in do_enable_gui
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py", line 96 in activate_matplotlib
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1565 in <lambda>
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1581 in _activate_gui_if_needed
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2085 in _do_wait_suspend
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2062 in do_wait_suspend
File "main.py", line 5 in <module>
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124 in _run_code
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135 in _run_module_code
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321 in run_path
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284 in run_file
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430 in main
File "/home/battleman/.vscode-oss/extensions/ms-python.python-2022.16.1-universal/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39 in <module>
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/runpy.py", line 87 in _run_code
File "/home/battleman/anaconda3/envs/bug-report/lib/python3.9/runpy.py", line 197 in _run_module_as_main
debugpy 1.6.3
It seems to still happen. I'm not sure which log is necessary? Here are the ones generated after running and crashing.
Something I realized may not have been clear: Running the code works fine, and any breakpoint or stop before importing matplotlib works fine. Breaking at/before the import, then continue the run works just fine, and the code executes. But any "stop" (from a breakpoint, or stepover) after the matplotlib import creates the segfault.
File ".../pydevd/pydev_ipython/inputhookqt5.py", line 88 in create_inputhook_qt5
File ".../pydevd/pydev_ipython/inputhook.py", line 224 in enable_qt5
File ".../pydevd/pydev_ipython/inputhook.py", line 178 in enable_qt
File ".../pydevd/pydev_ipython/inputhook.py", line 540 in enable_gui
File ".../pydevd/pydev_ipython/matplotlibtools.py", line 30 in do_enable_gui
File ".../pydevd/pydev_ipython/matplotlibtools.py", line 96 in activate_matplotlib
So, the real issue is that it's trying to activate qt5 (so, I guess you have both qt6 and qt5 installed) and when it does that qt crashes.
One thing here is that the debugger doesn't currently support qt6 (I'll rename this issue accordingly).
In the meanwhile, you should be able to set:
"guiEventLoop": "none"
in your launch configuration to avoid the crash.
-- note: this will mean that graphs you create won't be interactive when you're stopped in a breakpoint until qt6 is actually supported -- at which point you should be able to remove that "guiEventLoop": "none" from your launch configuration.
So PyQt 5.15 ann PyQt5-sip 12.11. Installing jupyterlab (the package I actually need/use) instead of jupyter skips those, and make the environment viable.
The takeaway I get from that is that, more than support for PyQt6, it's the presence of both pyqt6* packages along with pyqt v5 and pyqt5* packages that is problematic. I guess this is expected beyond debugpy.
So either making sure I only have PyQt6 (thus no jupyter), or if necessary downgrading to PyQt5.
It's on the backlog now, but with no specific schedule. Generally speaking, when it comes to features, the ones that are in higher demand (as evidenced by e.g. GitHub upvotes) are scheduled to be implemented first.
Thank you for the report. Given our current resources are working on the Python 3.12 debugger, we will not be fixing this issues in the pre Python 3.12 debugger.
Thank you for the report. Given our current resources are working on the Python 3.12 debugger, we will not be fixing this issues in the pre Python 3.12 debugger.
Since v1.8.1 now supports Python 3.12, would you consider reopening this issue?
To clarify, by "pre-Python 3.12 debugger" we mean not support for a particular Python version, but the use of the new debugging APIs introduced in Python 3.12. While the most recent stable debugpy release supports Python 3.12, its overall architecture is still based on legacy Python APIs, and we are not heavily investing into that codebase at this point.
Activity
fabioz commentedon Nov 3, 2022
If you enable
faulthandler, does it show any error? -- see: https://docs.python.org/3/library/faulthandler.html for details on how to use it.Also, can you try with
debugpy 1.6.3?If it still happens with the
debugpy 1.6.3, can you provide the logging for that?See: https://github.com/microsoft/debugpy/wiki/Enable-debugger-logs for details on how to collect the logs.
Battleman commentedon Nov 4, 2022
With the following code I do get a stacktrace:
Stack trace
It seems to still happen. I'm not sure which log is necessary? Here are the ones generated after running and crashing.
debugger.vscode_5a0785b7-36ab-4aac-964d-2a96be337842.log
debugpy.adapter-334179.log
debugpy.launcher-334187.log
debugpy.pydevd.334192.log
debugpy.server-334192.log
Battleman commentedon Nov 4, 2022
Something I realized may not have been clear: Running the code works fine, and any breakpoint or stop before importing matplotlib works fine. Breaking at/before the import, then continue the run works just fine, and the code executes. But any "stop" (from a breakpoint, or stepover) after the matplotlib import creates the segfault.
fabioz commentedon Nov 4, 2022
Thanks,
faulthandlerdoes show the actual issue:So, the real issue is that it's trying to activate qt5 (so, I guess you have both qt6 and qt5 installed) and when it does that qt crashes.
One thing here is that the debugger doesn't currently support qt6 (I'll rename this issue accordingly).
In the meanwhile, you should be able to set:
"guiEventLoop": "none"in your launch configuration to avoid the crash.
-- note: this will mean that graphs you create won't be interactive when you're stopped in a breakpoint until qt6 is actually supported -- at which point you should be able to remove that
"guiEventLoop": "none"from your launch configuration.[-]Debugpy stops with jupyter, pyqt6 and matplotlib installed[/-][+]Support pyqt6[/+]Battleman commentedon Nov 4, 2022
Ah I see. Indeed, when installing
jupyterwith conda, the two following come along, that I didn't spot:So PyQt 5.15 ann PyQt5-sip 12.11. Installing
jupyterlab(the package I actually need/use) instead of jupyter skips those, and make the environment viable.The takeaway I get from that is that, more than support for PyQt6, it's the presence of both pyqt6* packages along with pyqt v5 and pyqt5* packages that is problematic. I guess this is expected beyond debugpy.
So either making sure I only have PyQt6 (thus no
jupyter), or if necessary downgrading to PyQt5.Thank you for your kind help!
MarcosCalvi commentedon Feb 28, 2023
I am wondering, is the problem the qt_loaders file or is there something more? Sorry for my ignorance but I don't know how debugpy works inside
int19h commentedon Mar 1, 2023
It's also the input hooks in the same package - that's the part that works with matplotlib.
MarcosCalvi commentedon Mar 3, 2023
Ok, thank you, I thought so, it is a shame it is not included PySide6. Do you know if it is in the planning to make it compatible at some point?
int19h commentedon Mar 3, 2023
It's on the backlog now, but with no specific schedule. Generally speaking, when it comes to features, the ones that are in higher demand (as evidenced by e.g. GitHub upvotes) are scheduled to be implemented first.
EricAtORS commentedon Mar 16, 2023
I have the same. I worked around it by deleting the PyQt5 folder.
MarcosCalvi commentedon Mar 20, 2023
What do you mean? In the debugpy installation folder?
judej commentedon Jan 3, 2024
Thank you for the report. Given our current resources are working on the Python 3.12 debugger, we will not be fixing this issues in the pre Python 3.12 debugger.
EricAtORS commentedon Jan 8, 2024
From my site-packages folder.
I had both pyqt5 and pyqt6. I don't need pyqt5 so I just deleted the pyqt5 folder.
MironMA commentedon Feb 27, 2024
Since v1.8.1 now supports Python 3.12, would you consider reopening this issue?
int19h commentedon Feb 27, 2024
To clarify, by "pre-Python 3.12 debugger" we mean not support for a particular Python version, but the use of the new debugging APIs introduced in Python 3.12. While the most recent stable debugpy release supports Python 3.12, its overall architecture is still based on legacy Python APIs, and we are not heavily investing into that codebase at this point.