uv: Installation of uv fails when $HOME variable is not set
When I Tried running the following command (mentioned in the docs) to install uv in amazon linux box where $HOME directory is unset for reasons unknown i get a failure saying $HOME is unset
curl -LsSf https://astral.sh/uv/install.sh | sh
Example - https://github.com/kishaningithub/setup-python-amazon-linux/issues/14#issuecomment-2325627058
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 18 (7 by maintainers)
Commits related to this issue
- Support Linux distros that don't set HOME Fixes https://github.com/astral-sh/uv/issues/6965#issuecomment-2915796022 — committed to astral-sh/cargo-dist by konstin a year ago
- Support Linux distros that don't set HOME Fixes https://github.com/astral-sh/uv/issues/6965#issuecomment-2915796022 — committed to astral-sh/cargo-dist by konstin a year ago
- Support Linux distros that don't set HOME Fixes https://github.com/astral-sh/uv/issues/6965#issuecomment-2915796022 — committed to astral-sh/cargo-dist by konstin a year ago
hey folks! I work on cargo-dist which is what the astral team uses to distribute
uv, really appreciate the discussion on this article and i’ve opened up an issue on our tracker to fully gather requirements for the install mode ya’ll are discussing here.https://github.com/axodotdev/cargo-dist/issues/1400
would love for you to share ideas there (i’ll also continue monitoring this issue for ideas!)
You can now set
UV_UNMANAGED_INSTALLto define a standalone installation directory, e.g.:@charliermarsh with
UV_UNMANAGED_INSTALLyou won’t need to pass--no-modify-pathas that’s behavior rolled into the env varJust noticed that this incantation works to install version 0.4.7 of uv and uvx to /usr/bin without writing any env files.
Setting UV_INSTALL_DIR=/ so it writes to /bin sort of works, but it appends a slash, so it becomes //bin which is not in $PATH, which makes the installer write /env and /env.fish as well.
@charliermarsh Just to confirm, this is still an issue - I’ve applied the fix @mil-ad suggested to get this working, but yeah, on Amazon Linux 2023 (or another OS where $HOME isn’t set), the installer cannot run, even in
UV_UNMANAGED_INSTALLset. Latest version.Same, I just defined a dummy
HOME="foobar"along withUV_UNMANAGED_INSTALLand it runs fine. The only problem is that one line.@charliermarsh The issue is not yet resolved. Getting the following error.
This is present in the latest install script. The failing code line is
RECEIPT_HOME="${HOME}/.config/uv"which is unconditionally trying to resolve$HOMEalways.@kishaningithub see https://docs.astral.sh/uv/configuration/installer/#unmanaged-installations
I ran into this as well, and ended up defining a HOME env var. My use case is auto installing
uvin a specific folder, usingCARGO_DIST_FORCE_INSTALL_DIR, andHOMEin my case ideally shouldn’t be involved at all. I see it’s used to generate a receipt file (which is also not needed in this case).What would be nice for automations like this is if the installer script simply dropped the correct
uvbinary in the specified target folder, and that’s it (no PATH modifications, no HOME involved etc)I think it would be great if we can pass in an argument to the shell script to explicitly state in which directory the installation should happen. That way the $HOME dependency can disappear.