Problems with PyQt5 on Raspi 5 / Debian Bookworm

Phil Thompson phil at riverbankcomputing.com
Mon Dec 18 10:19:18 GMT 2023


On 18/12/2023 07:40, ullix wrote:
> Am 15.12.23 um 17:34 schrieb Phil Thompson:
>> On 15/12/2023 16:23, ullix wrote:
>>> I got the new Raspi 5 and tested a few things. I used pip to
>>> install/modify a dozen packages, and all worked except for *PyQt5.*
>>> 
>>> PyQt5 had been apt-installed as version 5.15.9, and worked in tests 
>>> of
>>> mine. But what failed was when trying to upgrade to 5.15.10. After
>>> closer instepction I apt-removed the apt-installed PyQt5, and tried 
>>> to
>>> pip-install that very same version. It failed with :
>>> 
>>>   Preparing metadata (pyproject.toml): started
>>>   Preparing metadata (pyproject.toml): finished with status 'error'
>>> 
>>> Full error report in attached file.
>>> 
>>> After reinstalling 'python3-pyqt5' via apt, it worked again.
>>> 
>>> Where is the problem: Raspi, Debian, pip, pyqt5?
>>> 
>>> ullix
>>> 
>>> 
>>> On Raspi 5 I used the default OS install:
>>> 
>>> 
>>>      Raspberry Pi OS with desktop
>>> 
>>>  * Release date: December 5th 2023
>>>  * System: 64-bit
>>>  * Kernel version: 6.1
>>>  * Debian version: 12 (bookworm)
>> 
>> pip is attempting to build from source and needs extra options to be 
>> specified. You also need a reasonably up to date pip. It's much easier 
>> to use pip to install sip and PyQt-builder and download the sdist, 
>> then run sip-install in the untarred sdist.
>> 
>> Phil
> 
> 
> Thanks, but I don't understand what the consequences of your statement
> are. I also believe the problem indicates a broader problem.
> 
> Debian 12 (bookworm), the basis for the current Raspberry Pi OS, is
> drawing its conclusions from the success of Python and are now
> blocking the possibility of changing the Python installation of the OS
> by pip. (I know you can break this by deleting file file
> 'EXTERNALLY-MANAGED' of pip-install with flag '--break-system-files',
> but this is defeating the purpose of this blocking).
> 
> They now direct everyone towards a venv install. This works, though it
> requires extra steps.

I can see the justification of that for a desktop system which may be 
running a number of Python applications with conflicting dependencies. 
I'm less convinced that it is appropriate for an embedded platform more 
likely to be running a single application.

> However, for a clean venv you now need to install e.g. PyQt5, and this
> fails, as outlined above. Is this a bug? Is this a flaw introduced by
> the Raspi packagers? Or is this a introduced by Debian packagers,
> which means it will soon become a broader problem?

It's not a bug, it's a consequence of those policy decisions.

> Can you say what packages need to be installed to make installation of
> PyQt5 possible? Or is this a much deeper problem?

The build instructions are here...

https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html#building-and-installing-from-source

...but you also need platform-specific development packages installed.

This is not a PyQt-specific problem - it will affect any Python package 
that contains C/C++ extension modules and does not currently have Raspi 
wheels available on PyPI.

What's needed is somebody to step up and create Raspi PyQt wheels (I 
don't have the resources) which can be uploaded to PyPI so that "pip 
install PyQt5" will just work. I've made attempts over the years to 
engage with the Raspi community to address this but have never had a 
response.

Phil


More information about the PyQt mailing list