I am aware that some solutions for this have been suggested in 1, 2, and 3. I tried almost all of them. I tried:
- Running the pyuic5 using absolute paths for the file 4
- Uninstalling and installing different versions of pyqt5 and pyqt5-tools 5, 6
- I also tried copying the python3.dll from the python folder to the Scripts folder in the virtual environment 7, 8
None of these seemed to work, so I am trying to run PyQt5, I already have a .UI file and I would like to run it, but it keeps giving me the error. My machine is Windows 10
File ".\test.py", line 1, in <module> from PyQt5 import QtWidgets, uic
ImportError: DLL load failed: The specified module could not be found.
This is the test.py file:
from PyQt5 import QtWidgets, uic
import sys
app = QtWidgets.QApplication([])
win = uic.loadUi("User_Interface.ui") #specify the location of your .ui file
win.show()
sys.exit(app.exec())
I execute it in a virtual environment that has Python 3.7.9 (this is what appears when i type python -V
) with the command python test.py
The installed packages are the following (using the pip list
command):
click 6.7
packaging 21.3
pip 20.1.1
ply 3.11
pyparsing 3.0.9
PyQt5 5.9
pyqt5-tools 5.9.2.1.3
python-dotenv 0.20.0
setuptools 47.1.0
sip 4.19.8
toml 0.10.2
This solution 9 suggests upgrading the C++ runtime environment to 2015-2019, but I already have that.
If any more information is needed, I'll be happy to provide them. Any help is more than appreciated.
If PyQt5 works properly on your machine, can you state the packages and versions you have installed, so I can recreate your virtual environment