DLL load failed when importing PyQt5

gdRow picture gdRow · Mar 17, 2017 · Viewed 47.5k times · Source

I have installed PyQt5 on windows platform and and getting an importError: DLL load failed.

I have installed pyqt5 using the command

pip3 install pyqt5
Successfully installed pyqt5-5.8.1

My Python version 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 & Regards

Answer

Miloslav Raus picture Miloslav Raus · Mar 27, 2017

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