Hello,
I didn’t create this in the github because of the text that directs non-contributors to avoid doing so. I understand building from source is a niche activity. I am compelled either way to install Anki within a venv due to a plugin that requires this (due to some python dependencies they import conflicting with system packages), and because future commits seem likely to break that plugin (for other reasons). I like to compile against the current development head to track when exactly that happens (so I can stay at the most recent head where it works while I work on a fix).
libxml2
was updated recently on Arch. When I build within a .venv it will build fine, but when I go to run the resulting binaries, I get an error:
hearth@hearth ~/D/a/anki (main)> anki
Traceback (most recent call last):
File "/usr/bin/anki", line 5, in <module>
from aqt import run
File "/home/hearth/Development/anki/ankienv/lib/python3.12/site-packages/aqt/__init__.py", line 63, in <module>
from aqt import gui_hooks
File "/home/hearth/Development/anki/ankienv/lib/python3.12/site-packages/aqt/gui_hooks.py", line 11, in <module>
from _aqt.hooks import *
File "/home/hearth/Development/anki/ankienv/lib/python3.12/site-packages/_aqt/hooks.py", line 18, in <module>
from aqt.qt import QDialog, QEvent, QMenu, QModelIndex, QWidget, QMimeData
File "/home/hearth/Development/anki/ankienv/lib/python3.12/site-packages/aqt/qt/__init__.py", line 22, in <module>
from .qt6 import *
File "/home/hearth/Development/anki/ankienv/lib/python3.12/site-packages/aqt/qt/qt6.py", line 19, in <module>
from PyQt6.QtWebEngineCore import *
ImportError: libxml2.so.2: cannot open shared object file: No such file or directory
This implies something Anki is pulling is compiled against the old version. This happens regardless of whether I create the venv with --system-site-packages
or not, and regardless of whether I run from a symlink under /usr/bin/anki
, the anki binary in the venv with the venv sourced (eg. ankienv/bin/anki
), or the runanki
script under the qt
directory.
Interestingly, the AUR anki-git
package builds and also runs fine. The main difference I notice in it (besides setting clang directly) compared to what I am doing is its pip install call:
PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-warn-script-location --root-user-action=ignore --no-deps out/wheels/*.whl
This lead me to discover that running pip install
with --isolated
resolves the issue. However, it’s not clear to me exactly why it resolves the issue, where running pip install
within the venv does not. I notice that running with uv
via uv pip install --isolated --upgrade out/wheels/*.whl
also doesn’t work, even with --no-config
/--isolated
.
Any pointers on what exactly might cause this issue would be warmly welcomed.