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

Windows Server 2019 uv access is denied when executing #4980

Closed
Andrew-Chen-Wang opened this issue Jul 10, 2024 · 7 comments · Fixed by #8914
Closed

Windows Server 2019 uv access is denied when executing #4980

Andrew-Chen-Wang opened this issue Jul 10, 2024 · 7 comments · Fixed by #8914
Labels
bug Something isn't working windows Specific to the Windows platform

Comments

@Andrew-Chen-Wang
Copy link

I installed pyenv 3.12.4 in a Windows Server 2019 using AWS EC2. Created a virtualenv then tried running uv pip install -r requirements.txt. This results in

(.venv) PS C:\Users\andrew\Downloads> uv pip install bin/requirements/requirements-dev.txt
? `bin/requirements/requirements-dev.txt` looks like a local requirements file but was passed as a package name. Did you✔ `bin/requirements/requirements-dev.txt` looks like a local requirements file but was passed as a package name. Did you mean `-r bin/requirements/requirements-dev.txt`? · yes
Resolved 54 packages in 900ms
   Built tasks @ file:///C:/Users/andrew/Downloads/projects/tools/tasks
Prepared 2 packages in 7.40s
error: failed to remove file `C:\Users\andrew\Downloads\.venv\Lib\site-packages\../../Scripts/uv.exe`
  Caused by: Access is denied. (os error 5)

Running uv help works just fine.

Interesting solution

Renaming uv.exe from .venv/Scripts/uv.exe actually makes installation work

@charliermarsh
Copy link
Member

Did you install uv into the virtual environment itself? It looks like uv is trying to uninstall itself.

@charliermarsh
Copy link
Member

I believe this is the same as #1368.

@Andrew-Chen-Wang
Copy link
Author

Andrew-Chen-Wang commented Jul 10, 2024

Yes, after creating a virtualenv, we did pip install uv

@charliermarsh
Copy link
Member

Typically you would install uv globally, since uv doesn't need to be in the virtual environment in order to create it or install into it. (But it's also a known issue on Windows that uv cannot uninstall itself.)

@charliermarsh charliermarsh added bug Something isn't working windows Specific to the Windows platform labels Jul 10, 2024
@charliermarsh
Copy link
Member

I'm gonna merge into that other issue, but happy to answer questions there.

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2024
@Andrew-Chen-Wang
Copy link
Author

Ahh that's not really clear from the instructions. I assumed it's like pip where it needs to be installed in the virtualenv!

Screenshot 2024-07-10 at 18 08 31

@charliermarsh
Copy link
Member

Yeah uv will install into a currently-activated virtualenv even if it's not installed "in" the environment itself.

charliermarsh added a commit that referenced this issue Nov 8, 2024
## Summary

On Windows, we can't delete the currently-running executable -- at
least, not trivially. But the
[`self_replace`](https://docs.rs/self-replace/latest/self_replace/)
crate can help us here.

Closes #1368.

Closes #4980.

## Test Plan

On my Windows machine:

- `maturin build`
- `python -m venv .venv`
- `.venv/Scripts/activate`
- `pip install /path/to/uv.whl`
- `uv pip install /path/to/uv.whl`
- `uv pip uninstall uv`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Specific to the Windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants