Error loading DLL when importing PyQt5

I installed PyQt5 on a Windows platform and lost importError: DLL loading.

I installed pyqt5 using the command

pip3 install pyqt5 Successfully installed pyqt5-5.8.1 

My version of Python is as follows:

 Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 

The import error is as follows:

 from PyQt5.QtWidgets import QApplication Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: DLL load failed: The specified module could not be found. 

Thanks and Regards

+19
python pyqt5 importerror dllimport
source share
11 answers

This is due to the lack of Python3.dll (a dll stub that relays the functions of Python3x.dll , so that one version of the extension can work for several versions of python).

If your Python distribution does not bind python3.dll, you can try one of WinPython ( https://winpython.imtqy.com/ ).

At least versions 2017/04/01 should have this.

1) Download WinPython (the "zero" version is enough, there should be the same "main version" - 3.5 / 3.6 - and "bitness" - 32/64 - like your Python !!!).

2) Extract to some temp directory, take the python3.dll file and paste it into your python directory next to python3x.dll.

3) Enjoy the work of QT

+22
source share

I know the theme is old, but I also had this problem with the latest version of PyQT 5.11, but I downgraded it to 5.9 via:

 pip install PyQT5==5.9 

and this solved the problem.

+10
source share

If you created virtualenv, check if python3.dll copied to the Scripts directory of this virtual user. Most likely, only python35.dll (or python36.dll , etc., depending on the version of Python) was copied, in which case you will get the error you get.

+5
source share

I found an alternative solution.

I used virtualenv because PyCharm made one for me and I did not know better. I installed PyQt5 in this virtualenv.

I switched to using virtualenv and installed PyQt5 in the Python global directory. This fixed it.

+2
source share

In my case, I had 32-bit Windows 10 and Python 3.7.2. Using PyQt5 5.11 installed via pip, I got this error:

 from PyQt5.QtWidgets import QApplication Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: DLL load failed: The specified module could not be found. 

I noticed that version 5.11 comes without Qt libraries, so I reinstalled the earlier version using python -m pip uninstall PyQt5 and python -m pip install PyQt5==5.10

Never use --no-cache-dir, as this will result in a confirmation error when installing the whl file:

 assert building_is_possible assertion Error 

I finished installing 5.10 and received the following error:

 qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. 

After setting QT_DEBUG_PLUGINS and even the path to the plugin with:

 set QT_DEBUG_PLUGINS= set QT_PLUGIN_PATH=C:\Python37-32\Lib\site-packages\PyQt5\Qt\plugins 

I realized that the qwindows.dll dll was found in the correct path where it is located.

TL; DR: I restarted my Qt script in python with a rise in UAC, and I think it worked !

+1
source share

On Windows 10 using Python 3.6, I fixed this error by following these steps:

1) Install PyQt5 with pip install pyqt5

2) As explained on this Microsoft website , I changed the installation of the Visual Studio 2017 community by allowing "native Python development tools",

enter image description here

3) Copy python3.dll from C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64 to C:\IntelPython3\Lib\site-packages\PyQt5 (check your directory)

0
source share

You can try downloading the 64 - bit Python Installer (Windows x86-64 executable installer) from here . I am using PyQt5==5.10.1 . Solve my problem.

0
source share

This can also happen if you have installed the version of Anaconda that comes with PyQt5 and you override this package with the installed version in pip. Removing the version installed in pip fixed the problem for me.

0
source share

Decision

  1. Close all programs and compilers
  2. Open Anaconda Navigator. Make sure you have the pyqt and qtpy modules installed (qtawesome is optional).
  3. From Anaconda Navigator Home and VS Code Launch, Jupyter is your favorite editor.
  4. Launch your program! -

this is not a permanent fix, but it worked for me, hope it works and for you @Miloslav Raus the answer didn’t work for me

0
source share

The answer is quite simple sometimes. Many headaches passed because the application worked without problems before restarting the computer. However, I just told myself, maybe Windows just can't load the DLL module? So I restarted the computer again and started again .

Worked great. Hope this helped someone.

0
source share

I tried all the solutions here and some of them elsewhere, however any of them did not work for me. The solution that worked for me is to install a newer version of Python .

-one
source share

All Articles