PyQt6: DLL load failed while importing QtGui: The specified procedure could not be found.
-
My Environment
- OS:
Windows 10
- Python:
3.9.9
- Anaconda:
Anaconda3-2022.05-Windows-x86_64
- vitual environment: base,PyQt6
- The output of the command
pip list
when the virtual environment is "PyQt6":Package Version ---------------- --------- click 7.1.2 pip 21.3.1 PyQt6 6.1.0 pyqt6-plugins 6.1.0.2.2 PyQt6-Qt6 6.3.1 PyQt6-sip 13.4.0 pyqt6-tools 6.1.0.3.2 python-dotenv 0.20.0 qt6-applications 6.1.0.2.2 qt6-tools 6.1.0.1.2 setuptools 60.5.0 wheel 0.37.1
- The output of the command
pip list|findstr "Qt"
when the virtual environment is "base"PyQt6 6.3.1 PyQt6-Qt6 6.3.1 PyQt6-sip 13.4.0 QtAwesome 1.0.3 QtPy 2.0.1
The issue
When the vritual environment is "PyQt6", the code
from PyQt6 import QtWidgets
throws the error belowDLL load failed while importing QtGui: The specified procedure could not be found.
But, when the vritual environment is "base", the code runs normally
Why?How to solve it?
- OS:
-
Another test
First step, create a brand-new virtual environment, and then install PyQt6
conda create -n PyQt6_2 python=3.9.9 conda activate PyQt6_2 pip install PyQt6
Then, test the code
from PyQt6 import QtWidgets
Python >> from PyQt6 import QtWidgets
Everything runs fine now.
Second step, install
PyQt6-tools
pip install PyQt6-tools
Then, the code
from PyQt6 import QtWidgets
will throw the errorPyQt6: DLL load failed while importing QtGui: The specified procedure could not be found.
Comparsion
Before I installed
PyQt6
, the output ofpip list
wasPackage Version ---------- ------- pip 21.3.1 PyQt6 6.3.1 PyQt6-Qt6 6.3.1 PyQt6-sip 13.4.0 setuptools 60.5.0 wheel 0.37.1
After I installed
PyQt6
, the output ofpip list
wasPackage Version ---------------- --------- click 7.1.2 pip 21.3.1 PyQt6 6.1.0 pyqt6-plugins 6.1.0.2.2 PyQt6-Qt6 6.3.1 PyQt6-sip 13.4.0 pyqt6-tools 6.1.0.3.2 python-dotenv 0.20.0 qt6-applications 6.1.0.2.2 qt6-tools 6.1.0.1.2 setuptools 60.5.0 wheel 0.37.1
The tests on
base
andPyQt6
virtual environments are the same with this test.- In the first test, the virtual environment
base
installedPyQt6
and not installedPyQt6-tools
- In the first test, the virtual environment
-
@tanzi
Sounds potentially like a "DLL found but required symbol within DLL not found", an inconsistency within the C++ Qt DLLs or between them and PyQt6. I would search my whole disk for e.g.dir /s/b Qt*.DLL
. Any mixed versions? Any Qt5 artefacts? What version of PyQt6 versus Qt6 do you see? -
the problem starts on PyQt version 6.0.3. Do not install other modules that depends on the version above 6.03. I solve the issue by installing PyQt 6.0.2 and pyqt6-tools 6.0.2
my version list is the following
Package Version
click 7.1.2
pip 21.3.1
PyQt6 6.0.2
pyqt6-plugins 6.0.2.2.2
PyQt6-Qt 6.0.1
PyQt6-Qt6 6.0.2
PyQt6-sip 13.4.0
pyqt6-tools 6.0.2.3.2
python-dotenv 0.20.0
qt6-applications 6.0.2.2.2
qt6-tools 6.0.2.1.2
setuptools 60.2.0
wheel 0.37.1