You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Access is denied error on windows when uv sync #15968
Within a corporate environment, when running uv sync or uv add, I often get an Access is denied. (OS error 5) when it is trying to delete a directory. E.g. "Failed to remove directory C:\mylib.venv\Lib\site-packages\polars-123.data". It is usually the data or pycache
I'm unable to replicate this outside of a corporate environment, and cannot provide logs due to company policy. To resolve it I need to run uv sync / uv add multiple times, depending on the number of dependencies/transistive dependencies, can be 50+ times.
The trace shows the error coming from remove_dir_all
I don't see this problem with other package managers like pnpm / cargo, etc.
Not sure if this is the same exact issue, but I am also having problems with Windows Defender. I can not run uv at all though, and I had the same issue with pip as well. This is definitely something local IT / Windows should deal with, but I'll provide the log from Event Viewer anyways.
The event was triggered when running the command "uv --version" in command prompt.
I can consider generalising it for retry mechanism of other operations on Windows (persist_with_retry_sync, persist_with_retry, with_retry_sync, rename_with_retry), if that would be a preference.
There is already // TODO(zanieb): Look into reusing this code? suggestion for that from @zanieb
I don't think this is antivirus related. This is some behaviour difference when using the terminal inside vscode vs using a standard powershell terminal. Also given uv is the only thing that suffers from this (pip, cargo, etc...all work fine) makes it feel like this is definitely uv related and how it handles deleting files in windows.
Activity
retropc commentedon Oct 31, 2025
I've seen this too
uv add ruff ->
most likely defender is holding the directory open, need to wait and retry a few times
terrible but that's Windows for you
Ndnes commentedon Nov 21, 2025
Not sure if this is the same exact issue, but I am also having problems with Windows Defender. I can not run uv at all though, and I had the same issue with pip as well. This is definitely something local IT / Windows should deal with, but I'll provide the log from Event Viewer anyways.
The event was triggered when running the command "uv --version" in command prompt.
Enferlain commentedon Feb 13, 2026
cruzzil commentedon Feb 14, 2026
Interestingly I have found that the issue pretty much disappears if I open a fresh powershell and don't use the VScode terminal
RomanPszonka commentedon Jun 30, 2026
@woodruffw I'd like to work on this;
My solution follows an established pattern of retrying operations on Windows, but
deletewas left out.Initial draft at https://github.com/RomanPszonka/uv/pull/1/changes.
I can consider generalising it for retry mechanism of other operations on Windows (
persist_with_retry_sync,persist_with_retry,with_retry_sync,rename_with_retry), if that would be a preference.There is already
// TODO(zanieb): Look into reusing this code?suggestion for that from @zaniebSpectre5 commentedon Jul 14, 2026
@RomanPszonka are you still planning to submit this as a PR? I see you have 2 PRs in your own fork. I'd love for this to make its way into uv.
RomanPszonka commentedon Jul 14, 2026
@Spectre5 happy to... not sure what's the procedure. If any of maintainers could confirm which solution would be more acceptable?
Spectre5 commentedon Jul 14, 2026
@zanieb - there have been a handful of duplicates closed and linked to this issue, any chance some input by a maintainer can be provided here?
woodruffw commentedon Jul 29, 2026
Triage: deduping with #20792. Please help us make uv better by contacting your AV/EDR vendor per the info in that issue!
cruzzil commentedon Aug 1, 2026
I don't think this is antivirus related. This is some behaviour difference when using the terminal inside vscode vs using a standard powershell terminal. Also given uv is the only thing that suffers from this (pip, cargo, etc...all work fine) makes it feel like this is definitely uv related and how it handles deleting files in windows.
I think this should be re-opened