uv: `uv pip install --system` cannot create directory
- A minimal code snippet that reproduces the bug.
uv pip install --python 3.12 pre-commit
Resolved 10 packages in 44ms
error: Failed to install: cfgv-3.4.0-py2.py3-none-any.whl (cfgv==3.4.0)
Caused by: failed to create directory `/usr/local/lib/python3.12/dist-packages/cfgv-3.4.0.dist-info`
Caused by: Permission denied (os error 13)
- The current uv platform.
Ubuntu 22.04
- The current uv version (
uv --version).
uv 0.1.12
pip defaults to .local/lib/python3.12/site-packages/ if the directory is not writeable
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 28 (18 by maintainers)
This was also requested here: https://github.com/astral-sh/uv/issues/1584. I’m more open to supporting
--userthan to doing this automatic fallback.(Aside: we plan to add
pipx-like global installs for tools (https://github.com/astral-sh/uv/issues/1173). We actually have all the pieces we need to do this.)In case you don’t want to implement this automatic fallback, I think a more specific error message would be helpful (e.g. pointing to
--useroruv venv).I think it’s totally fair not to include it. The only reason I mentioned it is that it sounded like you were planning to add it in a previous comment.
--prefixsolution works fine too, at least with the official Docker images. Just needed to changePATH.Please see the extensive discussion at https://github.com/astral-sh/uv/issues/2077 regarding the
--userflag and workarounds.I don’t currently plan to support
--useras I’m not yet convinced that it outweighs its complexity budget. In other words, it adds a lot of complexity (both to uv and to the user experience) but doesn’t strike me as sufficiently useful to merit it – the situations in which folks want it seem rare and I feel like the alternative solutions are totally fine (I don’t think adding a venv is a big problem, nor is running with root privileges in a container). But I may change my mind on this in the future based on demand.Yeah, that’s something we want to transparently support in the future.
Definitely!