Discuss: Leo 6.7.8 will install only PyQt6

118 views
Skip to first unread message

Edward K. Ream

unread,
Feb 29, 2024, 8:20:40 AM2/29/24
to leo-editor

Recent revs to the 6.7.8 and "devel" branches install only PyQt6 when installing either from PyPi or GitHub. That is, both of the following will install PyQt6:


pip install leo # From PyPi

pip install -r requirements.txt # after git clone leo


Don't panic


This release, Leo 6.7.8, will continue to support both PyQt5 and PyQt6. The changes concern only what pip installs by default.


The next release, Leo 6.7.9, will remove support for PyQt5 only if everyone can install PyQt6 without problems.


Summary


The new installation requirements will install only PyQt6.


Leo's code will continue to support PyQt5.


There is plenty of time to reverse this experiment if it causes significant problems.


Your comments, please.


Edward

Edward K. Ream

unread,
Feb 29, 2024, 8:33:39 AM2/29/24
to leo-e...@googlegroups.com
On Thu, Feb 29, 2024 at 7:20 AM Edward K. Ream <edre...@gmail.com> wrote:

Recent revs to the 6.7.8 and "devel" branches install only PyQt6 when installing either from PyPi or GitHub. That is, both of the following will install PyQt6:


pip install leo # From PyPi

pip install -r requirements.txt # after git clone leo


I would prefer to migrate away from PyQt5, but this post discusses alternative dependencies. For example, pyproject.toml could contain.
[project.optional-dependencies]
gui = ["PyQt5"]
In that case the user could install PyQt5 with:
pip install leo[pyqt5]
I would rather avoid this complication, but we'll see.
Edward

Thomas Passin

unread,
Feb 29, 2024, 9:37:06 AM2/29/24
to leo-editor
I think that whether we can require pyqt6 should depend on whether it can be installed on a particular flavor of Linux.  That didn't used to be the case, but it may be now.  It is available on Ubuntu/XUbuntu, and probably on most Ubuntu-derived distros.

However, Leo won't run after installing on Ubuntu until you install something else.  The error message will be:

qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.


Here's the command needed to fix the issue:

sudo apt install libxcb-cursor0

I have some non-Ubuntu Linux VMs, and I'll check them for Qt6.

Edward K. Ream

unread,
Feb 29, 2024, 9:40:10 AM2/29/24
to leo-e...@googlegroups.com
On Thu, Feb 29, 2024 at 7:20 AM Edward K. Ream <edre...@gmail.com> wrote:

Recent revs to the 6.7.8 and "devel" branches install only PyQt6 when installing either from PyPi or GitHub.


Here is how I test the new dependencies without using PyPi.

pip-uninstall-all.cmd

@echo off

rem uninstall *all* of Leo's requirements *without* confirmation.

echo cd leo-editor
cd C:\Repos\leo-editor

echo pip freeze > temp_requirements.txt
call pip freeze > temp_requirements.txt

rem A hack: Remove leo.egg-info

echo del leo.egg-info
del leo.egg-info

echo pip uninstall -r temp_requirements.txt -y
call pip uninstall -r temp_requirements.txt -y --verbose

echo del temp_requirements.txt
del temp_requirements.txt

echo pip list
call pip list

echo done!

pip-install-r.cmd

@echo off

rem Install Leo's requirements. This does *not* install leo itself.

cd C:\Repos\leo-editor

echo pip install -r requirements.txt --no-warn-script-location
call pip install -r requirements.txt --no-warn-script-location

echo pip list
call pip list

Run these from the leo-editor folder created by git clone <the url for Leo's repo>.

I first run pip-uninstall-all, giving me a completely clean environment.

Then I run pip-install-r to install all of Leo's dependencies.

Summary

It's easy to test Leo's new dependencies.

Please report any problems running  pip-install-r especially any problems installing PyQt6.

Thanks.

Edward

Edward K. Ream

unread,
Feb 29, 2024, 10:25:13 AM2/29/24
to leo-e...@googlegroups.com
On Thu, Feb 29, 2024 at 8:37 AM Thomas Passin <tbp1...@gmail.com> wrote:
I think that whether we can require pyqt6 should depend on whether it can be installed on a particular flavor of Linux.  That didn't used to be the case, but it may be now.  It is available on Ubuntu/XUbuntu, and probably on most Ubuntu-derived distros.

However, Leo won't run after installing on Ubuntu until you install something else.  The error message will be:

qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.


Here's the command needed to fix the issue:

sudo apt install libxcb-cursor0

Thanks for this, Thomas. It looks like requirements.txt must specify Qt5 on Linux.

Edward

Edward K. Ream

unread,
Feb 29, 2024, 10:32:12 AM2/29/24
to leo-e...@googlegroups.com
On Thu, Feb 29, 2024 at 9:25 AM Edward K. Ream <edre...@gmail.com> wrote:

> It looks like requirements.txt must specify Qt5 on Linux.

I've just changed the requirements as follows:

    # Use PyQt5 by default.
    "PyQt5>= 5.15; os_name != 'nt'",
    "PyQtWebEngine; ; os_name != 'nt'",

    # Use PyQt6 on Windows.
    "PyQt6>= 6.6; os_name == 'nt'",
    "PyQt6-WebEngine; os_name == 'nt'",

So it looks like the dream of using only PyQt6 is still on hold.

Please keep testing on all platforms.  Thanks.

Edward

Thomas Passin

unread,
Feb 29, 2024, 10:46:05 AM2/29/24
to leo-editor
So far all the distros I have checked do now support pyqt6:

Ubuntu/XUbuntu
Debian
OpenSuSE
Fedora
Manjaro
Mint

These are all the distros I've got VMs for.

Edward K. Ream

unread,
Feb 29, 2024, 10:55:55 AM2/29/24
to leo-e...@googlegroups.com
On Thu, Feb 29, 2024 at 9:46 AM Thomas Passin <tbp1...@gmail.com> wrote:
So far all the distros I have checked do now support pyqt6:

Ubuntu/XUbuntu
Debian
OpenSuSE
Fedora
Manjaro
Mint

These are all the distros I've got VMs for.

Thanks for the report. Do you think requirements.txt can specify only PyQt6?

Edward

Thomas Passin

unread,
Feb 29, 2024, 11:38:33 AM2/29/24
to leo-editor
It's looking better than say a year ago. I currently don't have any more distros to try.  Manjaro, which I listed above, is based on Arch-Linux, so probably any distro derived from Arch will have Qt6 too.  The big one I don't have and won't have is Red Hat.  It used to be that Fedora was basically Red Hat, but I don't think that's quite true any more.

Maybe someone else reading this will know more?

Edward K. Ream

unread,
Mar 1, 2024, 5:33:34 AM3/1/24
to leo-e...@googlegroups.com
On Thu, Feb 29, 2024 at 10:38 AM Thomas Passin <tbp1...@gmail.com> wrote:

>> Do you think requirements.txt can specify only PyQt6?

> It's looking better than say a year ago. I currently don't have any more distros to try.

My question wasn't clear. I meant to ask whether potential errors concerning the missing xcb-cursor0 or libxcb-cursor0 libraries are a show stopper.

Imo, most linux users will know to run sudo apt install, so the missing library isn't a significant barrier to requiring PyQt6. A new FAQ entry might be all that is needed. Do you agree?

Edward

Thomas Passin

unread,
Mar 1, 2024, 7:32:23 AM3/1/24
to leo-editor
On Friday, March 1, 2024 at 5:33:34 AM UTC-5 Edward K. Ream wrote:
My question wasn't clear. I meant to ask whether potential errors concerning the missing xcb-cursor0 or libxcb-cursor0 libraries are a show stopper.

Imo, most linux users will know to run sudo apt install, so the missing library isn't a significant barrier to requiring PyQt6. A new FAQ entry might be all that is needed. Do you agree?

A year ago I might have said it was a show-stopper.  But now the error message from Ubuntu was clear enough that running its suggested command fixed the issue.  In years past I had to go to the internet and wade through a lot of useless posts to find the right command (I've saved it in my workbook to make it easier to find).  I do know that some non-technical people will read the error message and yet not know what to do, so I agree with a FAQ entry.

BTW, Ubuntu/XUbuntu is the only distro where I've encountered this issue so far.

Edward K. Ream

unread,
Mar 1, 2024, 8:08:48 AM3/1/24
to leo-e...@googlegroups.com
On Fri, Mar 1, 2024 at 6:32 AM Thomas Passin <tbp1...@gmail.com> wrote:
On Friday, March 1, 2024 at 5:33:34 AM UTC-5 Edward K. Ream wrote:
I meant to ask whether potential errors concerning the missing xcb-cursor0 or libxcb-cursor0 libraries are a show stopper.

Imo, most linux users will know to run sudo apt install, so the missing library isn't a significant barrier to requiring PyQt6. A new FAQ entry might be all that is needed. Do you agree?

A year ago I might have said it was a show-stopper.  But now the error message from Ubuntu was clear enough that running its suggested command fixed the issue...I agree with a FAQ entry.

BTW, Ubuntu/XUbuntu is the only distro where I've encountered this issue so far.

Thanks for your comments. I'll update requirements.txt so it only installs PyQt6. I'll also add a FAQ entry.

Edward

Viktor Ransmayr

unread,
Mar 17, 2024, 3:20:17 PM3/17/24
to leo-editor
Hello Edward, hello Thomas,

I have encountered this problem as well, when I tried to install Leo from the devel-branch into a newly created Fedora 38 VM.

When I try to install the mentioned libraries I receive the following error msg:

###

    [user@Test-VM1 ~]$
    [user@Test-VM1 ~]$ ./leo &
    [1] 1513
    [user@Test-VM1 ~]$ setting leoID from os.getenv('USER'): 'user'

    qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    Available platform plugins are: linuxfb, vnc, minimal, wayland-egl, eglfs, vkkhrdisplay, offscreen, wayland, xcb, minimalegl.

    ./leo: line 2:  1517 Aborted                 (core dumped) python ~/leo-editor/launchLeo.py $1

    [1]+  Exit 134                ./leo
    [user@Test-VM1 ~]$
    [user@fedora-38-minimal-vr ~]$ sudo dnf install libxcb-cursor0
    Last metadata expiration check: 2:19:22 ago on Sun Mar 17 12:29:58 2024.
    No match for argument: libxcb-cursor0
    Error: Unable to find a match: libxcb-cursor0
    [user@fedora-38-minimal-vr ~]$
    [user@fedora-38-minimal-vr ~]$ sudo dnf install xcb-cursor0
    Last metadata expiration check: 2:19:56 ago on Sun Mar 17 12:29:58 2024.
    No match for argument: xcb-cursor0
    Error: Unable to find a match: xcb-cursor0
    [user@fedora-38-minimal-vr ~]$

###

What am I missing ?

With kind regards,

Viktor
 

Thomas Passin

unread,
Mar 17, 2024, 3:41:32 PM3/17/24
to leo-editor
Try the other suggested library in the error message:  xcb-cursor0 . I went through the same thing about a week ago on a different distro, and using the alternate suggestion solved it.  If that doesn't work either, run an internet search for "fedora qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin." This may surface another library name that your distro has.

Viktor Ransmayr

unread,
Mar 17, 2024, 3:45:56 PM3/17/24
to leo-e...@googlegroups.com
Hello Thomas,

Am So., 17. März 2024 um 15:41 Uhr schrieb Thomas Passin <tbp1...@gmail.com>:
Try the other suggested library in the error message:  xcb-cursor0 . I went through the same thing about a week ago on a different distro, and using the alternate suggestion solved it.  If that doesn't work either, run an internet search for "fedora qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin." This may surface another library name that your distro has.

I tried both libraries ! - See my log ...
 
--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/a257a7e3-343e-4f9e-bfde-f3c58b9f9b72n%40googlegroups.com.

Jacob Peck

unread,
Mar 17, 2024, 4:03:24 PM3/17/24
to leo-e...@googlegroups.com
My go-to ‘what package do I need’ tool is pkgs.org.  They’re showing that the package for Fedora 38 is called xcb-until-cursor.  Linux library management leaves much to be desired, in general.


Hope this helps!
Jake

On Mar 17, 2024, at 3:45 PM, Viktor Ransmayr <viktor....@gmail.com> wrote:



Viktor Ransmayr

unread,
Mar 17, 2024, 4:32:17 PM3/17/24
to leo-editor
Hello Jake,

gates...@gmail.com schrieb am Sonntag, 17. März 2024 um 16:03:24 UTC-4:
My go-to ‘what package do I need’ tool is pkgs.org.  They’re showing that the package for Fedora 38 is called xcb-until-cursor.  Linux library management leaves much to be desired, in general.


Hope this helps!

That was the missing piece. - Leo is now starting in the newly created Fedora 38 Test-VM ...

###

    Leo Log Window
    Leo 6.7.8, devel branch, build ef60a151f1
    2024-03-15 09:30:14 -0500
    Python 3.11.8, PyQt version 6.6.2
    linux

    setting leoID from os.getenv('USER'): 'user'
          home: /home/user
    leo-editor: /home/user/leo-editor
          load: /home/user/leo-editor/leo/core
        config: /home/user/leo-editor/leo/config
    reading settings in /home/user/leo-editor/leo/config/leoSettings.leo
    unexpected error creating: None
    Traceback (most recent call last):
      File "/home/user/leo-editor/leo/commands/spellCommands.py", line 65, in create
        f = open(fn, mode='wb')
            ^^^^^^^^^^^^^^^^^^^
    TypeError: expected str, bytes or os.PathLike object, not NoneType

###

Thanks a lot for your tip related to the ‘what package do I need’ tool !

This should help me a lot in the future.

With kind regards,

Viktor

Thomas Passin

unread,
Mar 17, 2024, 6:39:50 PM3/17/24
to leo-editor
That's a great tip.  Thanks!
Reply all
Reply to author
Forward
0 new messages