ImportError when opening anki

I run Arch linux and am using Anki 2.1.54, and decided to install Ki command line tool for converting Anki collections into git repos.

After doing a full system update, installing Ki and restarting my computer, anki has stopped working and replied with the following error:

File "/usr/bin/anki", line 17, in <module> import aqt File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 74, in <module> from aqt.main import AnkiQt # isort:skip File "/usr/lib/python3.10/site-packages/aqt/main.py", line 21, in <module> import aqt.mediasrv File "/usr/lib/python3.10/site-packages/aqt/mediasrv.py", line 25, in <module> import aqt.operations File "/usr/lib/python3.10/site-packages/aqt/operations/__init__.py", line 12, in <module> from anki.collection import ( ImportError: cannot import name 'ImportLogWithChanges' from 'anki.collection' (/home/yaoretian/.local/lib/python3.10/site-packages/anki/collection.py)

I have tried fixing the problem by restarting my computer again, reinstalling anki and uninstalling Ki but none of these have worked.

I could not find a similar topic when searching it up either. Does anyone know how to fix this?

How did you install Anki?

From the AUR, using yay

yay -Syu anki

https://docs.ankiweb.net/platform/linux/distro-packages.html

I’ve managed to fix the problem by installing the anki-official-binary-bundle from the AUR, which was the only package that worked out of every package I have tried

This solves the problem for now, and I hope the other packages may be fixed soon too

There are two packages for Anki (AFAIK) that are currently maintained on AUR:

  • The binary one, which fetches a precompiled, bundled version of Anki, and installs it.
  • The “regular” one, which tries to use Arch’s packages as dependencies instead of the one bundled with Anki.

For technical reasons, doing a “regular” packaging of Anki has proved to be quite hard. Last time I checked, only two package managers / distributions claimed to have done so (and kept up with versions), one of which was Arch through AUR (but note this took quite some time: for some months, that package wasn’t available). So it’s not unlikely that the package broke again. Maybe you should submit this issue to the packager.