Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

qt_loaders.py uses the removed imp module (Python 3.12) #1531

Open
ondrudav opened this issue Mar 4, 2024 · 1 comment · May be fixed by #1569
Open

qt_loaders.py uses the removed imp module (Python 3.12) #1531

ondrudav opened this issue Mar 4, 2024 · 1 comment · May be fixed by #1569
Labels
bug Something isn't working

Comments

@ondrudav
Copy link

ondrudav commented Mar 4, 2024

Environment data

  • debugpy version: 1.8.1
  • OS and version: Windows 10 Enterprise 10.0.19045
  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.1 and pip 24.0
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Pydevd runs into an exception when enabling matplotlib interactive mode for Qt5 backend.

Failed to enable GUI event loop integration for 'qt'
Traceback (most recent call last):
  File "c:\Users\Z004N92M\.vscode\extensions\ms-python.python-2024.2.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydev_ipython\matplotlibtools.py", line 30, in do_enable_gui    enable_gui(guiname)
  File "c:\Users\Z004N92M\.vscode\extensions\ms-python.python-2024.2.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydev_ipython\inputhook.py", line 540, in enable_gui        
    return gui_hook(app)
           ^^^^^^^^^^^^^
  File "c:\Users\Z004N92M\.vscode\extensions\ms-python.python-2024.2.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydev_ipython\inputhook.py", line 176, in enable_qt
    from pydev_ipython.qt_for_kernel import QT_API, QT_API_PYQT5
  File "c:\Users\Z004N92M\.vscode\extensions\ms-python.python-2024.2.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydev_ipython\qt_for_kernel.py", line 116, in <module>      
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
                                   ^^^^^^^^^^^^^^^^^
  File "c:\Users\Z004N92M\.vscode\extensions\ms-python.python-2024.2.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydev_ipython\qt_loaders.py", line 276, in load_qt
    if not can_import(api):
           ^^^^^^^^^^^^^^^
  File "c:\Users\Z004N92M\.vscode\extensions\ms-python.python-2024.2.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydev_ipython\qt_loaders.py", line 152, in can_import       
    if not has_binding(api):
           ^^^^^^^^^^^^^^^^
  File "c:\Users\Z004N92M\.vscode\extensions\ms-python.python-2024.2.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydev_ipython\qt_loaders.py", line 115, in has_binding      
    import imp
ModuleNotFoundError: No module named 'imp'
Backend QtAgg is interactive backend. Turning interactive mode on.

Expected behavior

Interactive mode is turned on without printing a traceback.

Steps to reproduce:

  1. Install matplotlib 3.8.3, PyQt5 5.15.10 and setuptools 69.1.1
  2. Debug this script with a breakpoint on the print call:
import matplotlib
print()
@int19h int19h added the bug Something isn't working label Mar 4, 2024
@luyun1
Copy link

luyun1 commented Apr 11, 2024

Hello, following your instructions, I reinstalled matplotlib 3.8.3, PyQt5 5.15.10 and setuptools 69.1.1. However, I still made the above error. Here is my error message. Could you please provide me with some relevant guidance? I would really appreciate it.
OS: Windows 11
Python version: 3.12.2
IDE: Pycharm 2024.1
Snipaste_2024-04-11_18-08-24

Error: Failed to enable GUI event loop integration for 'qt' Traceback (most recent call last): import imp ModuleNotFoundError: No module named 'imp' Backend QtAgg is interactive backend. Turning interactive mode on.

@stermart stermart linked a pull request Apr 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants