Build the venv from the distribution's Python instead of uv

The backend now targets 3.11, which is what Raspberry Pi OS ships, so there is
nothing left for uv to solve. It was only ever there to obtain a 3.13 the distro
does not have, and it brought its own problems: the download had to be matched
to the Pi's 32-bit userland by hand, and no armv7 wheel exists for a 3.13 ABI,
so Pillow was compiled from source and needed image headers installed alongside.

apt for the interpreter, python3 -m venv, pip for the rest - and piwheels then
supplies prebuilt armhf wheels for the native dependencies.

A venv cannot be migrated between interpreters (it holds absolute paths into the
one that made it), and `creates:` would keep the old one forever, so check what
built it and rebuild when it does not match the current python3. That is what
carries a device off the uv-installed 3.13 without hand-holding.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 21:21:12 +02:00
parent 6fcc345a26
commit 9bd23467f0
3 changed files with 41 additions and 63 deletions

View File

@@ -5,24 +5,6 @@ pi_musicmouse_repo: "ssh://git@git.bauer.tech:2222/martin/musicmouse.git"
# `git push -f origin <branch>:deploy/musicdolphin` and re-run this role.
# musicmouse_version: "deploy/musicdolphin"
pi_musicmouse_python_version: "3.13"
pi_musicmouse_uv_version: "0.12.10"
# Which uv build to download. Raspberry Pi OS ships a 64-bit kernel with a 32-bit
# userland, so `uname -m` (and therefore ansible_architecture) says aarch64 on a box
# that can only run armhf binaries - the aarch64 build installs fine and then fails to
# exec with "No such file or directory", which is the dynamic loader missing, not the
# file. ansible_userspace_bits is the fact that tells the truth.
pi_musicmouse_uv_target: >-
{{ 'armv7-unknown-linux-gnueabihf'
if (ansible_architecture in ['aarch64', 'armv7l', 'armv6l'] and ansible_userspace_bits == '32')
else _pi_musicmouse_uv_targets[ansible_architecture] }}
_pi_musicmouse_uv_targets:
aarch64: aarch64-unknown-linux-gnu
armv7l: armv7-unknown-linux-gnueabihf
armv6l: armv7-unknown-linux-gnueabihf
x86_64: x86_64-unknown-linux-gnu
# Where to check out the repo on the *control machine* to build the frontend (npm isn't
# installed on the Pi - see README). Keyed by version so different hosts on different
# versions don't clobber each other's build.