Configure uv.toml with link-mode=copy to prevent broken venv symlinks #60
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
.venv/bin/pythonsymlink periodically breaks because it points to/root/.local/share/uv/python/...(inaccessible to kert). This happens when any process runs uv as root — the absolute symlink bakes in root's python path.Root cause
uv defaults to
link-mode = "symlink"which creates absolute symlinks from.venv/bin/python→ the managed python. If the venv was created by root, the symlink targets root's python cache. The kert user can't follow it.CI already sets
UV_LINK_MODE=copybut the local dev environment doesn't.Fix
Create
uv.toml(project-level uv config) with:This makes uv copy the python binary into
.venv/bin/instead of symlinking it. A copy doesn't break when user context changes.python-preference = "managed"ensures uv always uses its own managed python (from~/.local/share/uv/python/) rather than system python, which is more predictable.Also
.venv/to.gitignoreif not already thereuv sync --devis the single setup commandFiles
uv.toml(new).gitignore(verify)