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

28,492

Solution 1

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.

Solution 2

I had a similar issue.

Everything worked when I completely uninstalled 32-bit version of Python, installed a 64-bit one, and reinstalled all the packages for amd64, including the PyQt5.

Solution 3

I experienced similar difficulties trying to install PyQt5 into an existing Python3.6 installation on Windows10 at C:\apps\Python36

  1. Don't install the download from https://www.riverbankcomputing.com/software/pyqt/download5 and if you have already installed it, uninstall using Windows Control Panel>Programs>Uninstall

  2. Open a new CMD prompt and ensure your PATH is set to include Python and Scripts

PATH=C:\apps\Python36;C:\apps\Python36\Scripts;%PATH%

  1. In the CMD shell, install PyQt5 using pip: pip install PyQt5. Afterwards check the installed packages:
     C:\>pip list
     Package    Version
     ---------- -------
     pip        10.0.1
     PyQt5      5.11.2
     PyQt5-sip  4.19.12
     setuptools 28.8.0
  1. There is a 'Hello World' program at https://www.tutorialspoint.com/pyqt/pyqt_hello_world.htm but it results in many errors like: AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication' due to PyQt4/5 changes. Try this instead:
     import sys
     from PyQt5 import QtWidgets

     def window():
        app = QtWidgets.QApplication(sys.argv)
        w = QtWidgets.QWidget()
        b = QtWidgets.QLabel(w)
        b.setText("Hello World!")
        w.setGeometry(100,100,200,50)
        b.move(50,20)
        w.setWindowTitle("PyQt")
        w.show()
        sys.exit(app.exec_())

     if __name__ == '__main__':
        window()
  1. For further details of changes between PyQt4 and PyQt5 see http://pyqt.sourceforge.net/Docs/PyQt5/pyqt4_differences.html

Solution 4

Plese always make sure you are downloading the correct version of PyQt which is compatible with the python version you have, Curren PqQt only supports up to python 3.5.So you may need to install python 3.5 first and then follow the installation of PyQt.Hope it helps!

Share:
28,492
Ahmad Taha
Author by

Ahmad Taha

I am 13 years old and I love programming and hacking. EDIT : Now 14 Years and have advanced in Python and PyQt. Love GUI design

Updated on July 15, 2020

Comments

  • Ahmad Taha
    Ahmad Taha almost 4 years

    I recently installed the PyQt5 module setup for 32-Bit computers on Windows. But when I am trying to run their examples none of then would run. All of the examples provided were having the similar type of error as in the following image. And when I tried to import PyQt5 in the Python shell it just imported correctly.

    Enter image description here

    I think this shows PyQt is installed successfully.

    But when i try to run the examples it shows like:

    enter image description here

    This is of one example and other examples have different 'no founds'

    Facts - Running Windows 7, PyQt5 latest version, Python 3.5, Installed PyQt5 from original site with setup

    I know there are several questions of such type, but none helped me because most of them were for Linux.

  • The Compiler
    The Compiler about 8 years
    That's because the current PyQt setup is for Python 3.4, not 3.5. PyQt 5.6 will be compiled for Python 3.5 on Windows, and released as a PyPI wheel. pip install pyqt5 currently installs the prerelease of that.
  • kinsley kajiva
    kinsley kajiva about 7 years
    so whats the best proper way to install pyqt5,because this is not working at all ... i mean at all it is not working in python 3.5 or 3.6 win 32 version !!!!!!! Please help!!!!
  • Frank Smith
    Frank Smith almost 7 years
    Still seems to be a problem with PyQt 5.9 and Python 3.5.2. :-(