Help with PyQt6-WebEngine on linux

106 views
Skip to first unread message

lewis

unread,
Jul 31, 2024, 3:47:43 AM7/31/24
to leo-editor
I get these errors when Leo loads on wsl Debian.

Leo Log Window
Leo 6.8.1
Python 3.11.2, PyQt version 6.7.2
linux
setting leoID from os.getenv('USER'): 'lewisneal'
      home: /home/lewisneal
leo-editor: /home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages
      load: /home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/core
    config: /home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/config
reading settings in /home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/config/leoSettings.leo
reading settings in /home/lewisneal/.leo/myLeoSettings.leo
reading settings in /home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/themes/tbp_dark.leo
Traceback (most recent call last):
  File "/home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/core/leoPlugins.py", line 544, in loadOnePluginHelper
__import__(moduleName)
  File "/home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/plugins/viewrendered3.py", line 983, in <module>
qwv = QtWebEngineWidgets.QWebEngineView
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'QWebEngineView'
Traceback (most recent call last):
  File "/home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/core/leoPlugins.py", line 544, in loadOnePluginHelper
__import__(moduleName)
  File "/home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/plugins/freewin.py", line 269, in <module>
QWebEngineView = QtWebEngineWidgets.QWebEngineView
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'QWebEngineView'
[end]

I tried installing PyQt6-Webengine
$ pipx install PyQt6-WebEngine

Note: Dependent package 'pyqt6' contains 2 apps
  - pylupdate6
  - pyuic6

No apps associated with package pyqt6-webengine. Try again with
'--include-deps' to include apps of dependent packages, which are listed
above. If you are attempting to install a library, pipx should not be used.
Consider using pip or a similar tool instead."

Please advise how to install PyQt6-WebEngine


lewis

unread,
Jul 31, 2024, 4:30:20 AM7/31/24
to leo-editor
I created a basic myLeoSettings file which ONLY enables the viewrendered3.py plugin.

[snip]
reading settings in /home/lewisneal/.leo/myLeoSettings.leo

Traceback (most recent call last):
  File "/home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/core/leoPlugins.py", line 544, in loadOnePluginHelper
    __import__(moduleName)
  File "/home/lewisneal/.local/pipx/venvs/leo/lib/python3.11/site-packages/leo/plugins/viewrendered3.py", line 983, in <module>
    qwv = QtWebEngineWidgets.QWebEngineView
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Thomas Passin

unread,
Jul 31, 2024, 7:46:15 AM7/31/24
to leo-editor
I don't know the answer so I'll flail around with a few things that I do know.  Please forgive me if you have already considered them.

The simplest thing that comes to mind - one that bites me from time to time - is forgetting to source the venv activate script before using the venv. Then Python doesn't use the right paths to the library files.  So:

source ~/.local/pipx/venvs/leo/bin/activate

You may be able to get useful information from Qt by exporting a debug variable before running Leo:

export QT_DEBUG_PLUGINS=1

You may be able to cure the problem by setting certain paths.  Then you might be able to succeed in installing the Qt6-QWebEngine.  Or it might have been installed but can't be used without these paths. You would export these before running Leo or installing the package, but you have to find out the right paths for your system:

export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/qt6/plugins/platforms
export QT_PLUGIN_PATH=/usr/lib/qt6/plugins/platforms


If your Debian install already has the locate command or can install it, find the platforms  path with:

locate -r 'platforms$' |grep -i qt6

Otherwise (but much slower):

find / 2>/dev/null -type d -name platforms |grep -i qt6

If none of the above do the job, I'm out of suggestions for the moment. I have many different Linux VMs including Debian and they are all working so I won't be able to reproduce the problem.

lewis

unread,
Aug 18, 2024, 5:26:56 AM8/18/24
to leo-editor
On Wednesday, July 31, 2024 at 9:46:15 PM UTC+10 tbp1...@gmail.com wrote:
I don't know the answer so I'll flail around with a few things that I do know.


Hi Thomas,
There are advantages to flailing around. You learn so much in the flail. I hope others can benefit from these notes.

Finally an update on running Leo on wsl Debian using the github installation method.
When using pip to install Leo, the "--break-system-packages" option is needed.

$ git clone https://github.com/leo-editor/leo-editor.git
$ cd leo-editor


So use:
~/leo-editor$ python3 -m pip install --break-system-packages -r requirements.txt

After starting Leo still reported WebEngine errors despite these packages being installed:
 PQt6-WebEngine-6.7.0
 PyQt6-WebEngine-Qt6-6.7.2
 PyQt6-WebEngineSubwheel-Qt6
 
I used this test script at https://www.riverbankcomputing.com/pipermail/pyqt/2024-August/045993.html
Received Traceback:
 ImportError: libsmime3.so: cannot open shared object file:

Investigated how to install libsmime3.so

During the saga of installing some missing linux files I installed wsl openSUSE-Tumbleweed and found the very useful command:
$ sudo zypper info --requires <package>
$ sudo zypper info --requires MozillaFirefox


This reports that libnss3 and libsmime3.so are requirements for MozillaFirefox package.

Package libnss3 is available in Debian
$ apt show libnss3
$ sudo apt install libnss3


Start Leo again and run the test script. Progress! One last error:
 from PyQt6.QtWebEngineWidgets import QWebEngineView
 ImportError: libxkbfile.so.1: cannot open shared object file: No such file or directory


$ sudo apt install libxkbfile1

Finally I have Leo running fully on wsl Debian, with both Freewin and VR3 plugins running.

Thomas Passin

unread,
Aug 18, 2024, 7:41:41 AM8/18/24
to leo-editor
Well Hallelujah! Finally.

I didn't know how to go from the library name (with the .so) to a package name. I don't know what we can do or say in the Leo installation instructions since the missing libraries are not Python packages (so pip can't install them) and what may be missing is so variable from one distro to the next. This will take some thought ... Thanks for the follow-up.

Edward K. Ream

unread,
Aug 18, 2024, 8:03:44 AM8/18/24
to leo-e...@googlegroups.com


On Sun, Aug 18, 2024 at 6:41 AM Thomas Passin <tbp1...@gmail.com> wrote:
Well Hallelujah! Finally.

:-) I'll soon create a PR that update's Leo's FAQ in LeoDocs.leo. I'll ask for comments before merging.

Edward

Edward K. Ream

unread,
Aug 18, 2024, 8:48:22 AM8/18/24
to leo-e...@googlegroups.com
I'll soon create a PR that update's Leo's FAQ in LeoDocs.leo. I'll ask for comments before merging.

See PR #4044.

Edward

lewis

unread,
Aug 19, 2024, 7:05:30 AM8/19/24
to leo-editor
I have continued to test installing Leo on some wsl linux versions.
These 3 valid distributions are from a longer list reported by wsl command
> wsl --list --online

NAME                                    FRIENDLY NAME
Debian                                   Debian GNU/Linux
Ubuntu-22.04                        Ubuntu 22.04 LTS
openSUSE-Tumbleweed     openSUSE Tumbleweed


With Ubuntu-22.04 installed I needed to add these 3 packages:
 libnss3, libatomic1, and libxkbfile1
Leo then runs fully on wsl Ubuntu-22.04. Freewin runs and VR3 also starts.

I chose Ubuntu as it is Debian based but still found variations a little annoying. Currently I'm trying to get Leo running on openSUSE-Tumbleweed.

Thomas Passin

unread,
Aug 19, 2024, 7:30:36 AM8/19/24
to leo-editor
I really dislike openSUSE. OTOH, I quite like Manjaro which is based on Arch but you don't need to make all those decisions and set up so many things.  If you can (I don't remember) try using Cinnamon as the desktop manager rather than Gnome. I find the current version of Gnome to be really annoying.
Reply all
Reply to author
Forward
0 new messages