Install PyQt5 on Raspberry for Python3.6

11,801

Solution 1

Today I found the solution. The steps below worked for me, without any error. The whole process took almost two hours.

sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install sip-dev

cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gz
sudo tar xzf sip-4.19.14.tar.gz
cd sip-4.19.14
sudo python3.6 configure.py --sip-module PyQt5.sip
sudo make
sudo make install

cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-5.12.tar.gz
sudo tar xzf PyQt5_gpl-5.12.tar.gz
cd PyQt5_gpl-5.12
sudo python3.6 configure.py
sudo make
sudo make install

Solution 2

Seems like they moved some things around. This seems to work, as far as getting things, and compiling them. It takes a long time to build.

For the associated designer, look at:

QtDesigner for Raspberry Pi

sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install sip-dev

cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.23/sip-4.19.23.tar.gz
sudo tar xzf sip-4.19.23.tar.gz
cd sip-4.19.23
sudo python3 configure.py --sip-module PyQt5.sip
sudo make
sudo make install

cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/5.13.2/PyQt5-5.13.2.tar.gz
sudo tar xzf PyQt5-5.13.2.tar.gz
cd PyQt5-5.13.2
sudo python3  configure.py
sudo make
sudo make install
Share:
11,801
EGuy
Author by

EGuy

Updated on June 17, 2022

Comments

  • EGuy
    EGuy about 2 years

    Since I found no answer for my question, neither in older posts nor in other forums, I want to ask the stackoverflow community for advice.

    I am using a raspberry pi 3B+, version 9.4 (lite) with kernel version 4.14.71-v7.

    I use python3.6. I installed it as follows:

    sudo apt-get install build-essential checkinstall
    sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
    
    cd /usr/src
    sudo wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
    sudo tar xzf Python-3.6.0.tgz
    
    sudo -s
    cd Python-3.6.0
    bash configure
    make altinstall
    exit
    

    Installation was without any trouble and everything works perfectly.

    Now I wanted to install the PyQt5 modul for python3.6. I usually use

    sudo python3.6 -m pip install ...
    

    for installing a modul for python3.6. Trying

    sudo python3.6 -m pip install pyqt5
    

    gave me the error message

     Could not find a version that satisfies the requirement PyQt5 (from versions: )
     No matching distribution found for PyQt5
    

    So I tried

    sudo apt-get update
    sudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools
    

    But it installed PyQt5 for python3.5 (which is preinstalled) on the raspberry.

    So does anybody know how to use or install PyQt5 for the subsequently installed python3.6?

    Edit 08.03.2019:
    Thanks FlyingTeller. I started to build from source. I followed the steps from your link.

    sudo apt-get update
    cd /usr/src
    sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gz
    sudo tar xzf sip-4.19.14.tar.gz
    cd sip-4.19.14
    sudo -s
    python3.6 configure.py --sip-module=PyQt5.sip 
    make
    make install
    
    cd /usr/src
    sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-5.12.tar.gz
    sudo tar xzf PyQt5_gpl-5.12.tar.gz
    cd PyQt5_gpl-5.12
    python3.6 configure.py
    

    Then I received the following error

    Error: Use the --qmake argument to explicitly specify a working Qt qmake.
    

    I think I am on the right way, but I do not understand what qmake is or what it means.

    Edit 10.03.2019:
    I could solve the last error message. I installed

    sudo apt-get install qt5-default
    

    Then I did the same procedure as already mentioned. Now I get the error

    fatal error: sip.h: File or directory not found 
    #include <sip.h>
    

    PyQt5 config.py is in: /usr/src/PyQt5_gpl-5.12
    SIP sip.h is in: /usr/src/sip-4.19.14

    Anybody an idea? Thanks guys.

    • Jeril
      Jeril over 5 years
      are you using a virtualenv
    • FlyingTeller
      FlyingTeller over 5 years
      Have you considered building from source?
    • EGuy
      EGuy over 5 years
      I am trying it but it has not worked yet. Check out the edits.
  • david
    david over 4 years
    you would better use "sudo make -j4"
  • smartmouse
    smartmouse over 4 years
    Why is that better?
  • Daisy QL
    Daisy QL over 4 years
    By using "-j4" flag will increase the installation speed.
  • Totoro
    Totoro about 2 years
    just for the benefit of someone who is curious, -j4 will divide the task to four CPU cores, thereby making teh installation faster.