# Issue running binaries compiled using current git head on Arch linux within a venv

**URL:** <https://forums.ankiweb.net/t/issue-running-binaries-compiled-using-current-git-head-on-arch-linux-within-a-venv/60304>\
**Category:** Development\
**Created:** [May 4, 2025, 9:12pm UTC](https://forums.ankiweb.net/t/issue-running-binaries-compiled-using-current-git-head-on-arch-linux-within-a-venv/60304 "2025-05-04T21:12:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hearth](https://avatars.discourse-cdn.com/v4/letter/h/35a633/32.png) [@hearth](https://forums.ankiweb.net/u/hearth)\
**Post date:** [May 4, 2025, 9:12pm UTC](https://forums.ankiweb.net/t/issue-running-binaries-compiled-using-current-git-head-on-arch-linux-within-a-venv/60304/1 "2025-05-04T21:12:52Z")

</div>

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:

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![hearth](https://avatars.discourse-cdn.com/v4/letter/h/35a633/32.png) [@hearth](https://forums.ankiweb.net/u/hearth)\
**Post date:** [May 5, 2025, 2:15am UTC](https://forums.ankiweb.net/t/issue-running-binaries-compiled-using-current-git-head-on-arch-linux-within-a-venv/60304/2 "2025-05-05T02:15:38Z")

</div>

Hmm, now I am a bit confused.

Earlier, the `--isolated` flag made the installed binaries work. I also tried building against the most recent tagged release and the two current beta tags. These worked _without_ the `--isolated` flag. However, some time passed, and the _same_ binary that worked before no longer works! I now cannot produce a working build at all form inside a venv.

---

<div class="post-metadata">

**Author:** ![hearth](https://avatars.discourse-cdn.com/v4/letter/h/35a633/32.png) [@hearth](https://forums.ankiweb.net/u/hearth)\
**Post date:** [May 5, 2025, 2:30am UTC](https://forums.ankiweb.net/t/issue-running-binaries-compiled-using-current-git-head-on-arch-linux-within-a-venv/60304/3 "2025-05-05T02:30:43Z")

</div>

Further updates:

- Any venv created with `virtualenv` don’t work.
- Any venv created with `python -m venv` work, regardless of `pip --isolated`, but _only_ for python 3.13. This is a problem for me, as one of the plugin’s dependencies is tied to python 3.12, and it’s unclear how soon there will be a version bump…

I suppose it may be unlikely/unexpectable that versions under 3.12 will be updated to work with newer libxml2 versions. As such I would imagine my options are to link against the old libxml2 (which seems a pretty bad idea on a system level on a desktop system), to figure out how to make some compatibility library linked specifically/only for the relevant binaries, or to downgrade Anki to an older version (I hadn’t updated for a while, hence only noticing these issues in the last day.)

Further edit: scratch that, it’s back to not working again, with exactly the same conditions!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [June 4, 2025, 2:31am UTC](https://forums.ankiweb.net/t/issue-running-binaries-compiled-using-current-git-head-on-arch-linux-within-a-venv/60304/4 "2025-06-04T02:31:41Z")

</div>

Closed on June 4, 2025, 2:31am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
