Installing Anki 25.02 via included install script on Ubuntu 24.04.2 then running via “anki” generates the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "aqt", line 63, in <module>
File "aqt.gui_hooks", line 11, in <module>
File "_aqt.hooks", line 18, in <module>
File "aqt.qt", line 22, in <module>
File "aqt.qt.qt6", line 12, in <module>
ImportError: /usr/lib/x86_64-linux-gnu/libQt6Core.so.6: version `Qt_6.6' not found (required by /usr/local/share/anki/lib/PyQt6/QtCore.abi3.so)
Anki bundles its own Qt6 libraries (which include the required Qt_6.6 symbols) inside the installation directory (e.g., /usr/local/share/anki/lib/PyQt6/Qt6/lib
). However, the launcher script sets LD_LIBRARY_PATH
as follows:
export LD_LIBRARY_PATH="/usr/local/share/anki/lib:$LD_LIBRARY_PATH"
But qt 6.6 is bundled in a deeper subdirectory inside of anki/lib, so the dynamic linker just looks for it in system directories, completely bypassing the module’s RUNPATH ($ORIGIN/Qt6/lib)
So the system Qt6 libraries are loaded (6.4.2 on Ubuntu) leading to the error.
Fix is easy, just change the launcher script to include a pointer to the bundled PyQt6 folder as well as the broader lib folder:
export LD_LIBRARY_PATH="/usr/local/share/anki/lib/PyQt6/Qt6/lib:/usr/local/share/anki/lib:$LD_LIBRARY_PATH"
Users can apply this fix independently with:
sudo sed -i 's|/usr/local/share/anki/lib:|/usr/local/share/anki/lib/PyQt6/Qt6/lib:/usr/local/share/anki/lib:|' /usr/local/bin/anki
A long time ago I had developer access and would have just put this on github as a pull request but it’s been a few years since I’ve had any time to contribute.
Can one of the devs fold this in? It’s a pretty simple patch but it breaks the ability of nontechnical users to use the program at all without rolling back several versions.
I guess it’s specified in the launcher script and packaging process rather than the code itself… not quite sure where those changes start.