Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv command on Windows: Inconsistent PATH set by installer #10014

Open
fdcastel opened this issue Dec 19, 2024 · 4 comments
Open

uv command on Windows: Inconsistent PATH set by installer #10014

fdcastel opened this issue Dec 19, 2024 · 4 comments
Labels
releases Related to building and distributing release artifacts of uv windows Specific to the Windows platform

Comments

@fdcastel
Copy link

Problem

The Windows installer currently does not configure the PATH system variable consistently.

Steps to reproduce

On a fresh installation of Windows 11, use the official script to install uv with the following command:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

✅ Working scenario

When the Terminal is opened through the right-click menu on the Windows Start button

Image

the PATH is properly configured, and the uv command functions as expected:

PS C:\> uv
An extremely fast Python package manager.

Usage: uv.exe [OPTIONS] <COMMAND>

(...)

❌ Non-working scenario

HOWEVER, when opening a new Powershell session with any of the following methods:

  • typing powershell on Start Menu; or
  • Using the "Run" command (WIN key + R) to run powershell.exe; or
  • Using "Open Powershell window here" from Windows Explorer right click context menu

the uv command is not found:

PS C:\> uv
uv : The term 'uv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ uv
+ ~~
    + CategoryInfo          : ObjectNotFound: (uv:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Additional comments

By comparing the $env:PATH variable across both sessions, I observed that the first session (the working session) includes an entry for C:\Users\<myuser>\.local\bin, which is absent in the second session.

@zanieb
Copy link
Member

zanieb commented Dec 19, 2024

Did you reboot after installation?

@zanieb zanieb added releases Related to building and distributing release artifacts of uv windows Specific to the Windows platform labels Dec 19, 2024
@fdcastel
Copy link
Author

No. Is this necessary?

I’m unable to do it at the moment as my test computer is occupied with a long batch operation. I should be able to reboot it in about 30 minutes.

In any case, a reboot shouldn’t typically be required for a straightforward tool installation, especially if it’s only related to PATH modifications.

@zanieb
Copy link
Member

zanieb commented Dec 19, 2024

At this time, yeah.

I agree. See axodotdev/cargo-dist#1614

@fdcastel
Copy link
Author

fdcastel commented Dec 19, 2024

Thank you @zanieb for both your clarifications and quick response.

I'm still unable to reboot the machine, but I did try to run this and I can confirm that it didn't work.

However, I did some additional tests with [Environment]::SetEnvironmentVariable() which seems to be promising. Please check this comment.

After using [Environment]::SetEnvironmentVariable() I can see the PATH updated in both scenarios I described in the original post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
releases Related to building and distributing release artifacts of uv windows Specific to the Windows platform
Projects
None yet
Development

No branches or pull requests

2 participants