Repository navigation
Description
Summary
- uv: uv 0.9.8 (85c5d32 2025-11-07)
- OS: Windows 10 Home; Version 22H2; OS Build 19045.6456; x64
- Installation method: as detailed in https://docs.astral.sh/uv/getting-started/installation/#standalone-installer (standalone installer via PowerShell run as admin); apparently succeeded
- Installation dir: C:\Users[my-user].local\bin
- uv executable permissions: all allowed for "SYSTEM", "Administrators", and my user (default after installation; no manual modification)
- The specific contents of
pyproject.toml/uv.lockdon't seem to be relevant, as I've encountered these issues for various packages and Python versions - Antivirus software (may or may not be relevant): Avast Free Antivirus
- Possibly related: Windows permissions errors on
uv remove Xwith clean install. #7382 andAccess is deniederror on windows whenuv sync#15968
Hi there. I really like the idea of uv, and I want to love it, but unfortunately, I've been plagued by issues with basic usage since installing (and reinstalling at least a couple of times).
There are two primary symptoms, but I'm including both in this issue because I strongly suspect they have the same root cause (an installation/permissions issue):
- Commands which involve modification of the project's /.venv/ files (created via
uv syncor another uv command and then modified by another uv command, e.g. manualpyproject.tomlmodification oruv add->uv lock->uv sync) fail with anAccess is denied. (os error 5). - Upgrading to a newer patch or minor version of Python 3 via uv (e.g. manual
pyproject.toml&.python-versionmodification ->uv lock->uv sync) resulted in a bizarre bug which caused a fatal error in my locally run Django application due to anattempt to write a readonly databaseerror, every time I attempted a write action (e.g. new contact message). I'm very confident that this isn't a Python/Django bug, because I've since tried installing one of the same Python versions (3.13.9) via the Python website/Windows installer, and the previous errors are no longer occurring for the same actions. Likewise, I previously tried upgrading Python by a single patch version via uv (3.11.9 -> 3.11.10, with nothing in the release notes that would obviously explain the issue in .10) and then encountered the error. What does confuse me is that version 3.11.9 of Python installed via uv (a few days ago, while encountering the issues with other versions of Python) was working fine, and likewise worked fine every time I reverted to it after encountering the issues above. As far as I could tell, this wasn't a version which was already installed elsewhere on my system, but perhaps I missed something.
Now that I'm aware of these issues, and for anyone else encountering the same, there are a couple of workarounds for each of the above, respectively:
- Delete the project's /.venv/ directory before updating the environment, i.e. before running
uv syncor another command which updates the local virtual environment. uv seems to have no issues writing to a new/clean directory, but the errors occur if it tries deleting/replacing any existing files. - Install Python outside of the uv ecosystem, where it can later be picked up by uv to be used in a virtual environment etc.
I appreciate that this is probably a fantastically difficult (impossible?) issue to debug, particularly considering there seem to be relatively few people affected by it (unless they've just given up and used something else, which apparently I'm a bit too stubborn to do...). With that said, given the headache it has caused me over the past week or two, if it's not feasible to replicate/fix then would it be possible to document these somewhere as known issues? (Or if not, at least this issue is documentation in itself!)
Thanks.
Platform
Windows 10 Home; Version 22H2; OS Build 19045.6456; x64
Version
uv 0.9.8 (85c5d32 2025-11-07)
Python version
N/A (encountered for 3.11.10, 3.12, 3.13 via uv installation)
Activity
[-]"Access is denied. (os error 5)" during `uv sync` and database write errors for Python installed via uv[/-][+]"Access is denied. (os error 5)" during .venv updates and database write errors for Python installed via uv[/+]Upgrade to Python 3.13
konstin commentedon Nov 18, 2025
Are there any Python processes still running when you get the error, including e.g. through an IDE? Which files are specifically affected, can you copy the full error message and ideally verbose output (
uv sync -v)? And finally, do you regularly switch between admin and non-admin terminal and applications?Cmastris commentedon Nov 23, 2025
Package update/removal error
Here's a full example starting from a fresh directory (running Git Bash as an administrator)...
Initiating a project and adding a new package seems to work fine:
However, the OS error is encountered when I try to update the package:
Details
Confirming that no Python processes are running:
Python SQL database write error
Here's an example using the same repository that I previously encountered issues with (running a new Git Bash shell as an administrator)...
Navigating to the project directory and activate the virtual env:
Display the project requirements:
Confirming the Python version and environment being used:
Displaying the list of Python versions (3.13.9 was installed via the Python website/installer, as noted in the original report):
Verifying that the contact form (local SQLITE3 db write) works:
Details
Modifying the Python version to the previous (not installed) patch version:
Syncing (note that the first issue occurs):
Details
At this point, I manually deleted the whole .venv directory via File Explorer and tried syncing again (this is a long one, but it appeared to work):
Details
Confirming the Python version being used:
Displaying the list of Python versions (note that 3.13.8 is now installed in the uv directory):
Re-testing the contact form:
Details
Interestingly, my tests using a test db work fine:
I then reverted all file changes, deleted the .venv, ran
uv sync, and re-tested the contact form, which worked again.I ran all of the above in the same Git Bash window, so Python shouldn't have been running except while I was running the local server.
I always run Git Bash as an administrator, and I ran PowerShell as an administrator for the uv installation per the instructions. Otherwise, I run applications (VS Code, but not using the built-in terminal; Chrome; File Explorer, but not with the .venv directory open; and maybe Notepad in this case) as a regular user.
zanieb commentedon Nov 23, 2025
I think a reasonable debugging step would be to disable Avast and Windows Defender temporarily and see if you can reproduce? It's possible they're scanning these files preventing us from mutating them?
Cmastris commentedon Dec 5, 2025
TL;DR: Thanks for nothing, Avast. Both issues were resolved after uninstalling Avast (and using Windows Defender/Security instead). As you suspected, Avast was evidently silently preventing the files from being mutated 😶. I will not be reinstalling it...
So, I tried uninstalling Avast (leaving Windows Security/Defender enabled). After that, I navigated to my test repo, deleted the existing .venv, and ran
uv sync. I then modified the pyproject.toml dependency (incremented pytest by a minor version), ranuv lock, and then ranuv sync. No issues. To double check, I then removed the dependency from pyproject.toml, re-ran the above, and still no issues. Issue #1 solved.I then switched back to my Django project repo and tried incrementing the Python patch version to 3.13.10. This version couldn't be found by uv when I tried
uv lock, so I upgraded uv (uv self update; 0.9.8 -> 0.9.15) and tried again. No issues that time, so I then ranuv syncto start using the new version installed via uv. Finally, I tried replicating issue #2 by running the local server and submitting a contact message (i.e. modifying the db). No issues! Issue #2 solved.Technically, I did introduce another change as part of this when I upgraded uv. However, considering nobody has been working on this and given that issue #1 was solved without the upgrade, I'm pretty sure that was all Avast's doing.
That's my issue sorted, but would you consider adding a note about this in the docs somewhere? Perhaps a new item in https://docs.astral.sh/uv/reference/troubleshooting/build-failures/? Something like...
Access is denied
If you receive an
Access is deniederror or similar when running uv commands that attempt to modify or delete files, or you encounter similar file/database modification errors using a version of Python installed via uv, then this may be a result of your security/antivirus software silently preventing these actions. Consider temporarily disabling this software to check if this resolves the issue. If so, switching to alternative software or modifying the settings may resolve the issue. As an alternative, you can work around these issues by installing Python directly and/or by manually deleting and rebuilding the project's virtual environment when updating the project dependencies.Thanks for your help with this.
josedelvalle-atl commentedon Jun 5, 2026
I'm encountering a very similar issue, I don't know if I should open another Issue, but for now I will put it here.
I also have a computer with a strict policy, so I thought it was a policy problem, however I think the problem is the uv build system.
I created a newly package using
uv init --packageand the resulting pyproject has the uv build system.If I try to run the associated script, I get
Switching the build backend to hatchling:
Solves the issue, so there must be something with the new build system that breaks, at least on windows.
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!