Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to install PyQt5 on raspbian stretch with python 3.6?



  • The only way that I was able to get PyQt5 installed and running on raspbian stretch was by installing with apt-get. But that version only appears to work with python 3.5. I need a version that works with python 3.6.

    pip install failed ...

    (qt) pi@qa:~ $ pip install PyQt5
    Collecting PyQt5
      Could not find a version that satisfies the requirement PyQt5 (from versions: )
    No matching distribution found for PyQt5
    
    (qt) pi@qa:~ $ pip install python3-pyqt5
    Collecting python3-pyqt5
      Could not find a version that satisfies the requirement python3-pyqt5 (from versions: )
    No matching distribution found for python3-pyqt5
    
    

    noticed that a version did seem to be available via agt-get

    (qt) pi@qa:~ $ apt-cache search pyqt5
    pyqt5-dev - Development files for PyQt5
    ...
    python-pyqt5 - Python 2 bindings for Qt5
    ...
    python3-dbus.mainloop.pyqt5-dbg - D-Bus Qt main loop support for Python 3 (debug extension)
    python3-pyqt5 - Python 3 bindings for Qt5
    python3-pyqt5-dbg - Python 3 bindings for Qt5 (debug extensions)
    ...
    

    I installed this ...

    (test) pi@qa:~ $ sudo apt-get install python3-pyqt5
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      libqt5clucene5 libqt5designer5 libqt5help5 python3-sip
    Suggested packages:
      python3-pyqt5-dbg
    The following NEW packages will be installed:
      libqt5clucene5 libqt5designer5 libqt5help5 python3-pyqt5 python3-sip
    0 upgraded, 5 newly installed, 0 to remove and 21 not upgraded.
    ...
    

    but it seems to have been built against python 3.5 ...

    (qt) pi@qacker:~ $ dpkg -L python3-pyqt5 | grep 35
    /usr/lib/python3/dist-packages/PyQt5/Qt.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtDBus.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtDesigner.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtGui.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtHelp.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtNetwork.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtPrintSupport.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtTest.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtWidgets.cpython-35m-arm-linux-gnueabihf.so
    /usr/lib/python3/dist-packages/PyQt5/QtXml.cpython-35m-arm-linux-gnueabihf.so
    

    if you try to use it with python 3.6, the import statement will fail ...

    this works

    >>> import PyQt5
    
    

    but this gives a No Module Found error

    >>> import PyQt5.QtGui
    

    Is it possible to get PyQt5 installed on raspbian stretch for use with python 3.6?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That's a question better asked to the PyQt authors on their mailing list.



  • @SGaist Apologies for posting to the wrong spot and thank you for directing me to the correct one. Much appreciated.


  • Lifetime Qt Champion

    No worries !

    Don't forget to update this thread when you get an answer so other people can benefit from it :)


Log in to reply