linuxserver / docker-calibre

GNU General Public License v3.0
339 stars 62 forks source link

python-qtwebengine in archlinuxarm docker image instead of python-qt5-webengine - dependency installed in wrong python version #86

Closed prahal closed 1 year ago

prahal commented 2 years ago

Expected Behavior

ebook-viewer start when called

Current Behavior

$ ebook-viewer 
Failed to import PyQt module: PyQt5.QtWebEngineCore with error: No module named 'PyQt5.QtWebEngineCore'
Traceback (most recent call last):
  File "/usr/sbin/ebook-viewer", line 21, in <module>
    sys.exit(ebook_viewer())
  File "/usr/lib/calibre/calibre/gui_launch.py", line 69, in ebook_viewer
    from calibre.gui2.viewer.main import main
  File "/usr/lib/calibre/calibre/gui2/viewer/main.py", line 9, in <module>
    from qt.webengine import QWebEngineUrlScheme
ImportError: cannot import name 'QWebEngineUrlScheme' from 'qt.webengine' (/usr/lib/calibre/qt/webengine.py)

Steps to Reproduce

  1. connect to the xrdp server
  2. run xterm
  3. enter ebook-viewer in it
  4. press enter. Or in calibre import a book and use calibre open with and choose ebook-viewer

NB: current image requires a qt5 upgrade with sudo pacman -Syu --noconfirm to workaround a glibc/qt5 migration breakage. This command also triggers a optional switch from python-pyqtwebengine to python-qt5-webengine:

:: Starting full system upgrade...
:: Replace python-pyqtwebengine with extra/python-pyqt5-webengine? [Y/n] 
resolving dependencies...
looking for conflicting packages...

NB2: https://github.com/linuxserver/docker-calibre/blob/arch/package_versions.txt tells that current packages are: python-pyqt5-webengine 5.15.5-4 while in the docker image from docker hub it is: local/python-pyqtwebengine 5.15.2-2 (pyqt5)

Both satisfy calibre dependency requirements. Maybe explicitly install python-pyqt5-webengine while installing calibre in the Dockerfile might avoid this discrepancy (which is proved at least on aarch64).

Environment

OS: armbian CPU architecture: arm64 How docker service was installed: from the official docker repo via portainer in a stack


## Command used to create docker container (run/create/compose/screenshot)
---
version: "2.1"
services:
  calibre:
    image: lscr.io/linuxserver/calibre:arch
    container_name: calibre
    environment:
      - PUID=1002
      - PGID=100
      - TZ=Europe/Paris
      - DOCKER_MODS=abws/mods:calibre-pacman-cache|abws/mods:calibre-log-openbox|abws/mods:calibre-readers|abws/mods:calibre-pycryptodome|abws/mods:calibre-filemanager
      - TMPDIR=$HOME/tmp
    volumes:
      - /srv/dev-disk-by-label-secure/appdata/docker/calibre:/config
      - /srv/dev-disk-by-label-store/media/calibre:/Calibre_Library
      - /srv/dev-disk-by-label-secure/ToCalibre:/config/ToCalibre
    ports:
      - 3389:3389
      - 8080:8080
      - 8081:8081
      - 9090:9090
    restart: unless-stopped
    cap_add:
      - SYS_ADMIN
    devices:
      - "/dev/fuse:/dev/fuse"

Docker logs

Not available

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

prahal commented 1 year ago

ping (to avoid this issue being closed without even having been read by devs)

thespad commented 1 year ago

I've checked the latest arch image and

# pacman -Q | grep webengine
python-pyqt5-webengine 5.15.6-1
qt5-webengine 5.15.10-2

As far as I can tell, python-pyqt5-webengine and python-pyqtwebengine are the same package: https://archlinux.org/packages/?sort=&q=python-pyqtwebengine

prahal commented 1 year ago

Thanks for checking. I will check latest image.

Me think the issue is in the archlinuxarm package definition. https://archlinuxarm.org/packages/aarch64/calibre tells it depends on https://archlinuxarm.org/packages/aarch64/python-pyqtwebengine which is python-pyqtwebengine 5.15.2-2 while https://archlinuxarm.org/packages/aarch64/python-pyqt5-webengine is which is python-pyqt5-webengine 5.15.6-1

The python-pyqt5-webengine provides python-pyqtwebengine alias so could be installed instead. But as shown by ebook-viewer they are not compatible. So this looks like an archlinux dependency management issue.

At the very least archlinux calibre should depends explicitly on python-pyqt5-webengine as parts of its binary are not compatible with python-pyqtwebengine. Ie no module named 'PyQt5.QtWebEngineCore' in PyQt5.QtWebEngineCore. The fact is python-pyqt5-webengine can replace python-pyqtwebengine but python-pyqtwebengine cannot replace python-pyqt5-webengine. The latter has added content.

So the bug is in arch. I believe that the docker-calibre image at times ends up with python-pyqt5-webengine or python-pyqtwebengine based on cheer luck as both fulfill the archlinux calibre dependency requirements. Would you like to workaround it here or do you want to avoid workaround and have it fixed in archlinux first ?

thespad commented 1 year ago

We'd always prefer an upstream fix, but if it's not forthcoming we'll look at a local workaround.

prahal commented 1 year ago

@thespad are you on aarch64 an arch ? https://github.com/linuxserver/docker-calibre/blob/arch/package_versions.txt also was telling me the package was python-pyqt5-webengine but on in my container back then I ended up with python-pyqtwebengine.

I started investigating for an archlinux fix but it might not be doable. https://archlinuxarm.org/packages/aarch64/calibre/files/PKGBUILD archlinux has a _pydeps pytqtwebengine which seems hard to force to specifically python-pyqt5-webengine :-/

prahal commented 1 year ago

@thespad I pulled linuxserver/calibre:arch-version-5a0df66e (latest archlinux docker-calibre for aarch64) for linux/arm64/v8 and:

18b7e6da4c81 ~ # pacman -Q | grep webengine
warning: database file for 'core' does not exist (use '-Sy' to download)
warning: database file for 'extra' does not exist (use '-Sy' to download)
warning: database file for 'community' does not exist (use '-Sy' to download)
warning: database file for 'alarm' does not exist (use '-Sy' to download)
warning: database file for 'aur' does not exist (use '-Sy' to download)
python-pyqtwebengine 5.15.2-2
qt5-webengine 5.15.10-2
prahal commented 1 year ago

arm64v8 https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-calibre/job/arch/66/execution/node/156/log/ arm32v7 https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-calibre/job/arch/66/execution/node/150/log/ both installs python-pyqtwebengine-5.15.2-2

x86 https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-calibre/job/arch/66/execution/node/144/log/ has extra/python-pyqt5-webengine 5.15.6-1

The pacman outputs differ depending on x86 or arm. Might be the baseimage (also from linuxserver) is not the same arch version ?

It might be that python-pyqtwebengine vs python-pyqt5-webengine is more an issue as python-pyqtwebengine-5.15.2-2 installs into /usr/lib/python3.9 while the container python is python3.10. There is:

a3d19ad301c4 ~ # ls /usr/lib/python3.9/site-packages/PyQt5/                         
QtWebEngine.abi3.so  QtWebEngineCore.abi3.so  QtWebEngineWidgets.abi3.so  bindings

a3d19ad301c4 ~ # pacman -Q -o /usr/lib/python3.9/site-packages/PyQt5/
warning: database file for 'core' does not exist (use '-Sy' to download)
warning: database file for 'extra' does not exist (use '-Sy' to download)
warning: database file for 'community' does not exist (use '-Sy' to download)
warning: database file for 'alarm' does not exist (use '-Sy' to download)
warning: database file for 'aur' does not exist (use '-Sy' to download)
/usr/lib/python3.9/site-packages/PyQt5/ is owned by python-pyqtwebengine 5.15.2-2

a3d19ad301c4 ~ # ls /usr/lib/python3.10/site-packages/PyQt5/
Qt.abi3.so           QtLocation.abi3.so           QtPrintSupport.abi3.so   QtSerialPort.abi3.so    QtWebKitWidgets.abi3.so        _QOpenGLFunctions_2_1.abi3.so       pyrcc.abi3.so
QtBluetooth.abi3.so  QtMultimedia.abi3.so         QtQml.abi3.so            QtSql.abi3.so           QtWebSockets.abi3.so           _QOpenGLFunctions_4_1_Core.abi3.so  pyrcc_main.py
QtCore.abi3.so       QtMultimediaWidgets.abi3.so  QtQuick.abi3.so          QtSvg.abi3.so           QtWidgets.abi3.so              __init__.py                         sip.cpython-310-aarch64-linux-gnu.so
QtDBus.abi3.so       QtNetwork.abi3.so            QtQuick3D.abi3.so        QtTest.abi3.so          QtX11Extras.abi3.so            __pycache__                         uic
QtDesigner.abi3.so   QtNfc.abi3.so                QtQuickWidgets.abi3.so   QtTextToSpeech.abi3.so  QtXml.abi3.so                  bindings
QtGui.abi3.so        QtOpenGL.abi3.so             QtRemoteObjects.abi3.so  QtWebChannel.abi3.so    QtXmlPatterns.abi3.so          pylupdate.abi3.so
QtHelp.abi3.so       QtPositioning.abi3.so        QtSensors.abi3.so        QtWebKit.abi3.so        _QOpenGLFunctions_2_0.abi3.so  pylupdate_main.py

a3d19ad301c4 ~ # pacman -Q -o /usr/lib/python3.10/site-packages/PyQt5/
warning: database file for 'core' does not exist (use '-Sy' to download)
warning: database file for 'extra' does not exist (use '-Sy' to download)
warning: database file for 'community' does not exist (use '-Sy' to download)
warning: database file for 'alarm' does not exist (use '-Sy' to download)
warning: database file for 'aur' does not exist (use '-Sy' to download)
/usr/lib/python3.10/site-packages/PyQt5/ is owned by python-pyqt5 5.15.7-1
/usr/lib/python3.10/site-packages/PyQt5/ is owned by python-pyqt5-sip 12.11.0-1

So no QtWebEngine for python3.10 is installed on ARM ? Because it seems calibre does not require QtWebEngine 5.15, 5.12 should do. But it is the archlinux packaging that does not check python version.

prahal commented 1 year ago

Keeping python-qtwebengine and this crude hack workaround the issue:

abc@a3d19ad301c4 ~ $ sudo ln -si /usr/lib/python3.9/site-packages/PyQt5/*.so /usr/lib/python3.10/site-packages/PyQt5/
abc@a3d19ad301c4 ~ $ sudo ln -si /usr/lib/python3.9/site-packages/PyQt5/bindings/QtWebEngine* /usr/lib/python3.10/site-packages/PyQt5/bindings/

So probably an archlinuxarm bug.

On archlinux python-pyqtwebengine is no more. https://archlinux.org/packages/?sort=&q=python-pyqtwebengine&maintainer=&flagged= shows only x86_64 | Extra | python-pyqt5-webengine | 5.15.6-1 | Python bindings for QtWebEngine | 2022-06-18 so I suspect x8- is not affected by this old python-qtwebengine package issue because the package is not in x86 repos.

prahal commented 1 year ago

Reported to archlinuxarm https://archlinuxarm.org/forum/viewtopic.php?f=15&t=16100 . Maybe wait a few weeks and if no reply implements a workaround in the Dockerfile

thespad commented 1 year ago

Is this still happening with Calibre v6?

prahal commented 1 year ago

How could calibre-ebook depending on python qt5 webengine be fixed by calibre 6 major release ? the issue is in the dependency not in calibre itself. I do not understand the way archlinuxarm handle bug via a forum. They replied only once to tell me something totally unrelated (they told me that python-pyqt5-webengine was python3.10 when I told them that python-qtwebegine was python3.9 only. I do not understand why they did not even checked python-qtwebengine a package. (not the qt instead of pyqt5- in the package name). Maybe I should open a new thread. It seems they do not read threads they already (improperly) replied to.

I do not expect them to fix the issue for years (they have to remove the broken package from their repositories and they do not care. So it will not be fixed on their side. I believe this affects also their native arm users.

We could force the installation of python-pyqt5-webengine in the linuxserver docker-calibre Docker by appendig to the pacman command .

thespad commented 1 year ago

Because Calibre v6 has moved to qt6.

prahal commented 1 year ago

indeed issue is fixed. Thanks for the heads-up. ebook-viewer is working now on armv8 and python qt webengine is indeed at qt6

abc@c2ede2ea16fe ~ $ pacman -Q |grep webengine
python-pyqt6-webengine 6.3.1-1
qt6-webengine 6.3.1-1