Skip to content

fix(backends): bootstrap uv when missing so install.sh can build venvs on minimal images (#10720)#10882

Open
localai-bot wants to merge 1 commit into
masterfrom
fix/libbackend-bootstrap-uv-10720
Open

fix(backends): bootstrap uv when missing so install.sh can build venvs on minimal images (#10720)#10882
localai-bot wants to merge 1 commit into
masterfrom
fix/libbackend-bootstrap-uv-10720

Conversation

@localai-bot

@localai-bot localai-bot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What

Backends installed onto a persistent /backends volume on a minimal base image (notably the nvidia-l4t-arm64-cuda-* variants) can never finish installing: local-ai backends install downloads the OCI layer, but the follow-up install.sh aborts at uv venv with:

./common/libbackend.sh: line 378: uv: command not found

These images ship neither uv nor pip, so there is no way to bootstrap the package manager from inside the container, and the backend is left permanently half-installed (reported in #10720, part 2 — "Recovery path via local-ai backends install is broken on the minimal image").

Fix

Add ensureUv(), invoked from ensureVenv() before any uv-based venv work. When uv is missing (and not in USE_PIP mode) it bootstraps a private copy into the backend's own directory (${EDIR}/uv-bin) via the official installer — the same mechanism the base images already use (backend/Dockerfile.python). Because ${EDIR} lives on the persistent /backends volume, the download happens only once and survives image upgrades. When uv is already on PATH (the normal case on full images) the function is a no-op.

Verification

  • bash -n syntax check passes.
  • Unit-tested the three no-network branches (pip mode, uv-already-present, pre-existing uv-bin) and the real download branch: on a PATH stripped of any uv, ensureUv installs uv 0.11.29 into ${EDIR}/uv-bin/uv and makes it available.

Scope

This addresses the broken-recovery-path half of #10720. The other suggestions in that issue (clearer ABI-mismatch diagnostics, elevating "backend upgrade available" to WARN, piping backend stderr into docker logs) are separate, larger changes and are not included here.

Part of #10720 (does not fully close it — the diagnostics/logging items remain).

Assisted-by: Claude:opus-4.8 [Claude Code]

…s on minimal images (#10720)

Minimal base images such as the nvidia-l4t variants ship neither uv nor
pip. When a backend is installed onto a persistent /backends volume there,
`local-ai backends install` downloads the OCI layer fine but the follow-up
install.sh aborts at `uv venv` with "uv: command not found", leaving a
half-built backend with no in-container recovery path.

Add ensureUv(), called from ensureVenv() before any uv-based venv work.
When uv is absent (and not in USE_PIP mode) it bootstraps a private copy
into the backend's own directory (${EDIR}/uv-bin) using the same official
installer the base images use. The directory lives on the persistent
volume, so the download happens only once and survives image upgrades.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:opus-4.8 [Claude Code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants