1

Trying to install PyQt5 on Raspberry Pi 3B, I followed instructions to first download, extract and install SIP and then download, extract and install PyQt5. Python 2.7 and 3.7 are both installed on my pi.

I have installed sip:

pi@raspberrypi:~/Downloads/sip-4.19.12 $ python3 configure.py 
This is SIP 4.19.12 for Python 3.7.0 on linux.
pi@raspberrypi:~/Downloads/sip-4.19.12 $ make

...ran for while, no errors

pi@raspberrypi:~/Downloads/sip-4.19.12 $ make install

...ran for while, no errors. Then I downloaded and extracted PyQt5 and now my problem is this:

pi@raspberrypi:~/Downloads/PyQt5_gpl-5.11.2 $ python3 configure.py 
Querying qmake about your Qt installation...
Error: Unable to import PyQt5.sip. Make sure you have configured SIP to create
a private copy of the sip module.

I am stuck now at configuring PyQt5. What can I do to resolve this?

2 Answers2

3

Why taking so much effort to install PyQt5 from sources with all its possible errors? It is part of the Raspbian repositories. Look what's available with:

rpi ~$ apt list *PyQt5*

There are also a lot of additional modules. You can simply install PyQt5 with all needed additional packages:

rpi ~$ sudo apt update
rpi ~$ sudo apt full-upgrade
rpi ~$ sudo apt install python3-pyqt5
Ingo
  • 42,107
  • 20
  • 85
  • 197
  • Thanks. Got it installed now. One followup question: in python code "from PyQt5 import QtCore" now results in "No module named 'PyQt5'. How can I make it find that module? – Tim van Steenbergen Jul 18 '18 at 17:52
  • @TimvanSteenbergen Glad that I could help :-) But I've never used PyQt5 so I don't know what are its module names to import. Best you ask this in a new question. That's the way this site works. – Ingo Jul 18 '18 at 18:56
  • Because I am trying to get it working with Python 3.7 and pipenv... – Ubuntourist Aug 06 '18 at 15:44
2

I found the answer provided at PyQt5 on a Raspberry Pi to be "mostly right". However, it's not quite that simple any longer. Following those directions yields

Error: Unable to import PyQt5.sip. Make sure you have configured SIP to create a private copy of the sip module.

The sip configuration now needs to be explicitly told to create PyQt5.sip rather than simply sip. See the discussion at http://python.6.x6.nabble.com/private-sip-td5235854.html

What worked for me:

  1. Download and unpack the sip and PyQt5 sources
  2. Then:

    $ cd <path to sip source>
    $ python3.x configure.py --sip-module=PyQt5.sip
    $ make
    $ sudo make install
    
    $ cd <path to PyQt5 source>
    $ python3.x configure.py
    $ make
    $ sudo make install
    
Ubuntourist
  • 161
  • 2