Open gaby opened 2 hours ago
Similar to the request in https://github.com/astral-sh/uv/issues/8431
You can use UV_TOOL_BIN_DIR
and UV_TOOL_DIR
for this right now. It seem sort of nice to have a flag for this, but I'm not sure if it's a high priority and generally these paths are different based on the distribution you're using so I'm hesitant to add defaults.
Oh I didn't know that was an option, That's neat trick although a bit verbose. The paths should be consistent between linux
and macos
. The feature is not supported for Windows (It's supported on Windows WSL through which uses sames paths as linux I believe.).
At least /usr/local/share/man
and /usr/local/bin
are consistent across distributions. The one where the global env's go is basically PIPX_HOME
.
I was able to replicate using the instructions from #8431
root@pi:/home/pi # docker run -it --rm --entrypoint=/bin/bash python:3.10-slim
root@68e761f4bba3:/# pip install uv
Collecting uv
Downloading uv-0.4.25-py3-none-manylinux_2_28_aarch64.whl (12.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.7/12.7 MB 16.4 MB/s eta 0:00:00
Installing collected packages: uv
Successfully installed uv-0.4.25
root@68e761f4bba3:/# mkdir -p /opt/uv/venv
root@68e761f4bba3:/# export UV_TOOL_BIN_DIR=/usr/local/bin
root@68e761f4bba3:/# export UV_TOOL_DIR=/opt/uv/venv
root@68e761f4bba3:/# uv tool install ruff
Resolved 1 package in 401ms
Prepared 1 package in 629ms
Installed 1 package in 3ms
+ ruff==0.7.0
Installed 1 executable: ruff
root@68e761f4bba3:/# pip list
Package Version
---------- -------
pip 23.0.1
setuptools 65.5.1
uv 0.4.25
wheel 0.44.0
root@68e761f4bba3:/# ruff version
ruff 0.7.0
Having a native way of doing this without setting 2 ENV's would be ideal.
The main purpose of this ticket is to request support for global venvs. Similar concept to what
pipx install --global
does. Where the package is installed in aglobal
venv instead of a user one. This allows for systems that pre-install applications for multiple-users to be able to manage/isolate these easily.Current workaround is to use
uv pip install --system ruff
. But this doesn't isolate the dependencies the same way a venv does and it's very easy to run into dependency issues between installed packages. We have a tried usingpipx
, but the inject ecosystem and upgrading packages using aspec
is inconsistent across the board. Currentlypipx
supports using--global
for all their commands.Information about how the
--global
inpipx
works is here: https://pipx.pypa.io/stable/installation/#-global-argumentWhen using
--global
inpipx
, the following happens:/usr/local/share/man
/usr/local/bin
/opt/pipx/venv
When injecting packages/dependencies into a package it does support passing
--global
, and these application binaries/man-pages also become global within that global venv.