Dll Load Failed When Importing Pyqt5

DLL load failed when importing PyQt5

It is because of missing Python3.dll (stub dll, that re-exports Python3x.dll functions, so that one version of extension can work for multiple versions of python).

If your Python distro doesn't bundle python3.dll, you can try one from WinPython (https://winpython.github.io/).

At least the 2017/04/01 versions should have it.

1) Download WinPython ('Zero' version suffices; must be same "main version" - 3.5/3.6 -and "bitness" - 32/64 - as your Python !!!).

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

3) Enjoy working QT

How to fix DLL load failed while importing QtWidgets?

Copy all dll's from PyQt5\Qt\bin to dist, except the ones beginning with Qt5* (You might not need d3dcompiler_47, libEGL, libGLESv2 and opengl32sw if your not using direct3d or opengl)

I suggest you try out to run your application converted with py2exe on a newly installed windows (maybe in a virtual machine) to find out if it has other dependencies.

Update: Actually, I only needed to install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019, without copying any dll files. https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0

PyQt5: The DLL load failed: the specified module could not be found

I got the answer to my own question.

When I tried to install it by setup, it did not ran properly. Then I uninstalled the setup and also ran the code in command line pip uninstall pyqt5 and then reinstalled by pip pip install pyqt5.

Then it perfectly ran, but by installing with pip it doesn't provide any examples so for that install the setup in any other directory and copy the examples in the PyQt5 folder. Done!

I think there may be some bug in the setup.

How do you fix this error: ImportError: DLL load failed: The specified module could not be found. using PyQt5

It looks like the environment variables have become corrupt after the update. In the simplest case, it should just be

Adding your DLL location of python, for example,

(C:\Program Files\Python35\DLLs)

in the path in Environment variables. You can also see some others possible solutions here

Related Topics

Leave a reply