Getting Qt5 version from the Python wheel

The change to Qt6 has broken Anki on my computer in 2.1.51, because I run a distro without systemd or Qt6. Previously I have been using the Python wheel to run Anki, which works fine for 2.1.49. Not so with 2.1.51.

I used pip install --upgrade aqt to install Anki (it mysteriously vanished today, hence why I noticed this issue so quickly after the release) and got the following error when attempting to run pyenv/bin/anki:

Traceback (most recent call last):
  File "~/programming/python-math/lib/python3.9/site-packages/aqt/qt/__init__.py", line 13, in <module>
    import PyQt6
ModuleNotFoundError: No module named 'PyQt6'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/programming/python-math/bin/anki", line 5, in <module>
    from aqt import run
  File "~/programming/python-math/lib/python3.9/site-packages/aqt/__init__.py", line 45, in <module>
    from aqt import gui_hooks
  File "~/programming/python-math/lib/python3.9/site-packages/aqt/gui_hooks.py", line 11, in <module>
    from aqt.hooks_gen import *
  File "~/programming/python-math/lib/python3.9/site-packages/aqt/hooks_gen.py", line 18, in <module>
    from aqt.qt import QDialog, QEvent, QMenu, QModelIndex, QWidget, QMimeData
  File "~/programming/python-math/lib/python3.9/site-packages/aqt/qt/__init__.py", line 15, in <module>
    from .qt5 import *  # type: ignore
  File "~/programming/python-math/lib/python3.9/site-packages/aqt/qt/qt5.py", line 11, in <module>
    from PyQt5.QtCore import *  # type: ignore
ModuleNotFoundError: No module named 'PyQt5'

(my home directory name/username has been obfuscated with ~ but other than that this is unedited)

So, I am curious: am I able to indicate to the Python wheel somehow that I want the Qt5 version? As I am unable to use the packaged releases due to their systemd dependency.

1 Like

PyQt wheels depend on systemd. If you’re providing your own PyQt then you’ll need to use the same instructions as for Linux (ARM):

https://betas.ankiweb.net/#via-pypipip