wayland support in wheels on Pypi
Phil Thompson
phil at riverbankcomputing.com
Fri Feb 21 10:27:17 GMT 2025
Apologies for not being able to reply earlier. An updated PyQt5-Qt5
wheel (build number 1) has been uploaded to the local PyPI server. If it
fixes the problem then I'll move it to pypi.org.
Answers to your questions are embedded below.
Phil
On 21/02/2025 08:42, Sergio Callegari wrote:
> I have digged a little further.
>
> On 19/02/2025 23:33, Sergio Callegari wrote:
>> Debugging as suggesting reveals that, as suspected, |pyqt5-qt5| does
>> not contain the wayland plugin, that is not in the wheel for this
>> package.
>
> It is my understanding that the wheels for pyqt5-qt5 on pypi are built
> using the PyQt-bundle tool, part of PyQt-builder. Can this be
> confirmed?
No. pyqt-bundle is used to embed your copy of Qt in your copy of the
PyQt5 wheels so that the PyQt5-Qt5 wheels on pypi.org are no longer
used. It is mainly used by commercial customers to create a single
commercial wheel (using their commercial copy of Qt) that they can
easily distribute to their developers.
The PyQt5-Qt5 wheels are created with pyqt-qt-wheel which is also part
of PyQt-builder but is undocumented.
> I also understand that PyQt-builder is available from Pypi, so one can
> install it and so get the pyqt-bundle command line tool. Is this
> correct?
Yes.
> Once one has this, it should be possible to run pyqt-bundle against
> your system QT library directory, and the pyqt-bundle should be able
> to pick the relevant part and make a wheel of it. If I get it right,
> this should be the way in which the PyQt5-Qt5 wheels present on Pypi
> are built by Phil Thompson, who is also the maintainer of the
> pyqt-builder framework. Right?
Yes.
> Now, assuming that the above points are right (my apology if they are
> not), there are still a few missing points for me.
>
> 1) Why does the "official" pyqt5-qt5 wheel from pypi miss the qt
> wayland plugin? is the bundle tool explicitly excluding it or is the
> wheel built from a QT distribution without it? In the latter case,
> would it be possible to update the wheel to also include the wayland
> plugin?
Normally the Qt wheels are created from an installation that itself was
created by the Qt online installer. This is because Qt is a pain to
build from source (specifically to get all the dependencies right).
However newer releases of Qt v5.15 no longer included in the online
installer and only available as source packages. I was happy to stick
with the last version that was included (v5.15.2) but then I wanted to
support PyQt5 on Apple silicon (my development platform). This meant
using a later version of v5.15 and having to build from source. Later on
I chose to build from source for Linux as well. I still plan to do the
same for Windows but haven't got round to it yet.
My Linux build of Qt missed the Wayland support which I have now
(hopefully) fixed.
> 2) Alternatively, do python packages have something like the
> 'provides' concept that most linux distro packaging systems have? In
> other words, would it be possible to have on pypi a pyqt5-qt-wayland
> package that provides pyqt5-qt also including the wayland plugin?
Yes. pyqt5-qt-wayland would contain just the missing plugins and have a
dependency on the original pyqt5-qt5 wheel.
> 3) Alternatively, can I use the pyqt-bundle cli tool to build my own
> pyqt5-qt5 wheel based on my system's qt5 that includes the wayland
> plugin and use that to satisfy the dependencies of other packages?
Yes. You'd have to take steps to ensure your version was used in
preference to the pypi.org version.
> 4) And finally: would it be possible to create a 'fake' pyqt5-qt5
> package to be used only locally merely pointing at the system qt5
> installation, without duplicating it?
The only way to use the system Qt5 (rather than a copy of it) would be
to use sip-install/sip-wheel to build PyQt5 from source. That is what
the Linux distros do to create their distro-specific build of PyQt.
> Thanks,
> Sergio
>
>
>> Trying to point to my system QT5 plugins does not work either. They
>> are recognized but they are not binary compatible, there must be some
>> difference in the toolchain.
>>
>> The pyqt5-qt5 package is said to contain the subset of a Qt
>> installation that is required by PyQt5. As of today that should
>> probably include also the wayland plugin, or there should be another
>> package on pypi providing it.
>>
>> Any clue?
>>
>> Sergio
>>
>> On 17/02/2025 09:32, Charles wrote:
>>
>>> Just set QT_DEBUG_PLUGINS [1], check where it tries to load the
>>> plugins, and if it is a wrong path, fix it using the methods in [2].
>>>
>>> As a python application it isn't always clear where the application
>>> path is which is used to load the plugins.
>>>
>>> [1] https://doc.qt.io/qt-6/debug.html#environment-variables-
>>> recognized-by-qt
>>> [2] https://doc.qt.io/qt-6/deployment-plugins.html
>>>
>>> On Mon, Feb 17, 2025 at 3:07 PM Sergio Callegari
>>> <sergio.callegari at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I have noticed a strange behavior from applications using PyQt5
>>> and PyQt5-Qt5 (seen using the python IDE spyder).
>>>
>>> When I run spyder after having installed it from the packages
>>> provided by my distribution (manjaro), spyder runs as a wayland
>>> application on my system.
>>>
>>> However, if I install spyder using pip, uv, or pipx (namely
>>> installation methods that rely on pre-built wheels from pypi),
>>> then spyder cannot run anymore as a wayland application. From its
>>> logs, I see that it cannot find the appropriate Qt plugin:
>>>
>>> Could not find the Qt platform plugin “wayland” in “”
>>>
>>> Now I wonder if there might be something missing in the pre-built
>>> wheels of PyQt5 distributed on Pypi.
>>>
>>> Being able to have Qt applications working as wayland
>>> applications
>>> could be beneficial on systems with two displays with different
>>> resolutions, which is a setup not well supported by some
>>> compositors with Xwayland.
>>>
>>> Thanks for the attention and your help,
>>>
>>> Sergio
>>>
>>>
>>>
>>
More information about the PyQt
mailing list