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
Open
fix(backends): bootstrap uv when missing so install.sh can build venvs on minimal images (#10720)#10882localai-bot wants to merge 1 commit into
localai-bot wants to merge 1 commit into
Conversation
…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]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Backends installed onto a persistent
/backendsvolume on a minimal base image (notably thenvidia-l4t-arm64-cuda-*variants) can never finish installing:local-ai backends installdownloads the OCI layer, but the follow-upinstall.shaborts atuv venvwith:These images ship neither
uvnorpip, 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 vialocal-ai backends installis broken on the minimal image").Fix
Add
ensureUv(), invoked fromensureVenv()before any uv-based venv work. Whenuvis missing (and not inUSE_PIPmode) 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/backendsvolume, the download happens only once and survives image upgrades. Whenuvis already onPATH(the normal case on full images) the function is a no-op.Verification
bash -nsyntax check passes.uv-bin) and the real download branch: on aPATHstripped of anyuv,ensureUvinstallsuv 0.11.29into${EDIR}/uv-bin/uvand 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]