uv: uv pip install inconsistent failure on Windows

  • Windows 22H2
  • Using PowerShell env (in either Windows Terminal or powershell.exe, non-elevated)

When using uv pip install -r requirements.txt, I will frequently get the following error:

error: Failed to download distributions
  Caused by: Failed to fetch wheel: setproctitle==1.3.3
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\Temp\1\.tmp56ZHLz\.tmpMXOwQn to \\?\C:\Users\[____]\AppData\Local\Temp\1\.tmp56ZHLz\archive-v0\7RXhEx7TcTNKRTlP3vSED
  Caused by: Access is denied. (os error 5)

This appears to be independent of the package, though seemingly happens more often with some than others.

If run with --no-cache, it’s almost impossible to install, as at least one thing is likely to fail in the process and progress restarted.

If run without --no-cache, retrying a number of times will eventually succeed (however, it will leave .tmp[_______] folders listed in the error messages in C:\Users\[____]\AppData\Local\uv\cache).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 77 (37 by maintainers)

Commits related to this issue

Most upvoted comments

Definitely want to fix this.

Never saw this kind of responsiveness in a project, respect! 🥇

The \\?\ prefix is just a way around the MAX_PATH (256 char) limitation in Windows API calls. I’d personally be surprised if it had an impact although I couldn’t say for sure.

Having dealt with similar issues in other projects where Windows antivirus software is holding file locks after any file system operations, the best solution is usually just to retry the operation on failure a handful of times with a slightly increasing sleep in between attempts unfortunately.

I think this issue may crop up in corporate or more secure environments that have some layer of security running over all processes.

Ah, this is consistent with the experience in the first post.

I think this issue may crop up in corporate or more secure environments that have some layer of security running over all processes. I think there is a slight lag between when uv unzips the files where that process is ran in a sandbox and there is a slight delay before the os will allow access to the resulting folder while its scanned, I think simply catching the “os error” and retrying with some timeout would prevent this error on systems that have some security layer that temporarily effects permissions and also why a package like numpy (big and many small files) would consistently trip and medium packages would occasionally go through and occasionally trip.

i.e. you may not be able to re-produce this error in dev without setting up a test box that use one of these paid corporate security software to trigger it. You generally only create windows binaries on tagged releases, if you can create a dev build binary I can test it on my system

Do you mind opening a separate issue with more details? That sounds like a bug (as opposed to a spurious failure).On Jul 24, 2024, at 7:46 AM, Pavel Dikov @.***> wrote: Clearly separate from the root cause here but since it’s mentioned here:

I’m open to changing to use the dunce-canonicalized version everywhere, but note that it doesn’t, like, fully solve the problem (if it is a problem). dunce will still return a UNC prefix if the path is longer than 260 characters.

@charliermarsh are you still open to this change? We’re hitting this problem with pyvenv.cfg (the home path in particular) – importing dynamic libraries from UNC-prefixed paths fails miserably for at least some Python versions. Happy to open another issue.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Ok more fixes coming in the next release.

I stress-tested v0.2.25 on our windows CI by focussing on source distributions only. They all passed and instead of failing because files in the cache can’t be renamed, I finally see retrying warnings like these:

WARN Retrying rename from \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmpTFyAcI\built-wheels-v3\.tmpFqzuFu\pywinusb-0.4.2 
to \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmpTFyAcI\built-wheels-v3\index\70e6dbc41e17fe7c\pywinusb\0.4.2\seIYCJmH_UpZwtxYdRGAe\pywinusb-0.4.2.zip due to transient error: 
failed to rename file from \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmpTFyAcI\built-wheels-v3\.tmpFqzuFu\pywinusb-0.4.2 
to \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmpTFyAcI\built-wheels-v3\index\70e6dbc41e17fe7c\pywinusb\0.4.2\seIYCJmH_UpZwtxYdRGAe\pywinusb-0.4.2.zip

🎉 Thanks a lot for your effort!

Looks like @zanieb already pushed a PR and may have found a fix, but should it be useful, here’s the IO activity of the thread from https://github.com/astral-sh/uv/issues/1491#issuecomment-2228830850

11:27:27.3794232 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\api\subapi\remove.py	SUCCESS	Offset: 0, Length: 2,176, Priority: Normal
11:27:27.4956009 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\cli\commands\download.py	SUCCESS	Offset: 0, Length: 3,256, Priority: Normal
11:27:27.5824242 AM	uv.exe	11604	CreateFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\cli\commands\search.py	SUCCESS	Desired Access: Generic Write, Read Attributes, Disposition: Create, Options: Synchronous IO Non-Alert, Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: 0, OpenResult: Created
11:27:27.5828526 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\cli\commands\search.py	BUFFER OVERFLOW	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan
11:27:27.5828966 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\cli\commands\search.py	SUCCESS	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\cli\commands\search.py
11:27:27.5829343 AM	uv.exe	11604	QueryBasicInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\cli\commands\search.py	SUCCESS	CreationTime: 7/15/2024 11:27:27 AM, LastAccessTime: 7/15/2024 11:27:27 AM, LastWriteTime: 7/15/2024 11:27:27 AM, ChangeTime: 7/15/2024 11:27:27 AM, FileAttributes: A
11:27:27.6779132 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\internal\cache\conan_reference_layout.py	SUCCESS	Offset: 0, Length: 3,802, Priority: Normal
11:27:27.7193186 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\test\assets\genconanfile.py	SUCCESS	Offset: 0, Length: 8,192, Priority: Normal
11:27:27.7570835 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\tools\apple\xcodedeps.py	FAST IO DISALLOWED	Offset: 8,192, Length: 8,047
11:27:27.7571054 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\tools\apple\xcodedeps.py	SUCCESS	Offset: 8,192, Length: 8,047, Priority: Normal
11:27:27.7995744 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\tools\cmake\cmakedeps\templates\target_data.py	SUCCESS	Offset: 16,384, Length: 4,231
11:27:27.8362180 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\tools\files\packager.py	SUCCESS	Offset: 0, Length: 4,177, Priority: Normal
11:27:27.8763317 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\tools\google\toolchain.py	SUCCESS	Offset: 0, Length: 8,113, Priority: Normal
11:27:27.8764108 AM	uv.exe	11604	ReadFile	C:\$Extend\$UsnJrnl:$J:$DATA	SUCCESS	Offset: 41,971,712, Length: 88, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
11:27:27.9159855 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan\tools\premake\premakedeps.py	SUCCESS	Offset: 0, Length: 8,192, Priority: Normal
11:27:27.9610159 AM	uv.exe	11604	CreateFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\cache\__init__.py	SUCCESS	Desired Access: Generic Write, Read Attributes, Disposition: Create, Options: Synchronous IO Non-Alert, Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: 0, OpenResult: Created
11:27:27.9615439 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\cache\__init__.py	BUFFER OVERFLOW	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan
11:27:27.9615946 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\cache\__init__.py	SUCCESS	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\cache\__init__.py
11:27:27.9616186 AM	uv.exe	11604	QueryBasicInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\cache\__init__.py	SUCCESS	CreationTime: 7/15/2024 11:27:27 AM, LastAccessTime: 7/15/2024 11:27:27 AM, LastWriteTime: 7/15/2024 11:27:27 AM, ChangeTime: 7/15/2024 11:27:27 AM, FileAttributes: A
11:27:28.0134359 AM	uv.exe	11604	CreateFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\graph\compute_pid.py	SUCCESS	Desired Access: Generic Write, Read Attributes, Disposition: Create, Options: Synchronous IO Non-Alert, Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: 0, OpenResult: Created
11:27:28.0140592 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\graph\compute_pid.py	BUFFER OVERFLOW	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan
11:27:28.0141104 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\graph\compute_pid.py	SUCCESS	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\graph\compute_pid.py
11:27:28.0141272 AM	uv.exe	11604	QueryBasicInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\graph\compute_pid.py	SUCCESS	CreationTime: 7/15/2024 11:27:28 AM, LastAccessTime: 7/15/2024 11:27:28 AM, LastWriteTime: 7/15/2024 11:27:28 AM, ChangeTime: 7/15/2024 11:27:28 AM, FileAttributes: A
11:27:28.0494167 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\client\remote_manager.py	SUCCESS	Offset: 0, Length: 8,192, Priority: Normal
11:27:28.1010791 AM	uv.exe	11604	CreateFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model	SUCCESS	Desired Access: Read Data/List Directory, Synchronize, Disposition: Create, Options: Directory, Synchronous IO Non-Alert, Open Reparse Point, Attributes: N, ShareMode: Read, Write, AllocationSize: 0, OpenResult: Created
11:27:28.1013980 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model	BUFFER OVERFLOW	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conan
11:27:28.1014297 AM	uv.exe	11604	QueryNameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model	SUCCESS	Name: \Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model
11:27:28.1014421 AM	uv.exe	11604	QueryBasicInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model	SUCCESS	CreationTime: 7/15/2024 11:27:28 AM, LastAccessTime: 7/15/2024 11:27:28 AM, LastWriteTime: 7/15/2024 11:27:28 AM, ChangeTime: 7/15/2024 11:27:28 AM, FileAttributes: D
11:27:28.1014725 AM	uv.exe	11604	CloseFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model	SUCCESS	
11:27:28.1015137 AM	uv.exe	11604	IRP_MJ_CLOSE	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model	SUCCESS	
11:27:28.1323508 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model\profile.py	FAST IO DISALLOWED	Offset: 8,192, Length: 62
11:27:28.1323753 AM	uv.exe	11604	WriteFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0\conans\model\profile.py	SUCCESS	Offset: 8,192, Length: 62, Priority: Normal
11:27:28.2281959 AM	uv.exe	11604	CreateFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0	SUCCESS	Desired Access: Read Attributes, Delete, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
11:27:28.2283100 AM	uv.exe	11604	QueryAttributeTagFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0	SUCCESS	Attributes: D, ReparseTag: 0x0
11:27:28.2283283 AM	uv.exe	11604	QueryBasicInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0	SUCCESS	CreationTime: 7/15/2024 11:27:27 AM, LastAccessTime: 7/15/2024 11:27:28 AM, LastWriteTime: 7/15/2024 11:27:28 AM, ChangeTime: 7/15/2024 11:27:28 AM, FileAttributes: D
11:27:28.2284142 AM	uv.exe	11604	CreateFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\index\f85683082b98592e\conan\2.5.0\Ac6VfyuHm-z0Y9-KNpzw5	SUCCESS	Desired Access: Append Data/Add Subdirectory/Create Pipe Instance, Synchronize, Disposition: Open, Options: , Attributes: n/a, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened
11:27:28.2285886 AM	uv.exe	11604	SetRenameInformationFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0	ACCESS DENIED	ReplaceIfExists: True, FileName: C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\index\f85683082b98592e\conan\2.5.0\Ac6VfyuHm-z0Y9-KNpzw5\conan-2.5.0.tar.gz
11:27:28.2288963 AM	uv.exe	11604	CloseFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\index\f85683082b98592e\conan\2.5.0\Ac6VfyuHm-z0Y9-KNpzw5	SUCCESS	
11:27:28.2289789 AM	uv.exe	11604	IRP_MJ_CLOSE	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\index\f85683082b98592e\conan\2.5.0\Ac6VfyuHm-z0Y9-KNpzw5	SUCCESS	
11:27:28.2290180 AM	uv.exe	11604	CloseFile	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0	SUCCESS	
11:27:28.2290773 AM	uv.exe	11604	IRP_MJ_CLOSE	C:\Users\username\AppData\Local\Temp\2\.tmpcUIakH\built-wheels-v3\.tmpQYLAdW\conan-2.5.0	SUCCESS	
11:27:29.1293378 AM	uv.exe	11604	Thread Exit		SUCCESS	Thread ID: 10608, User Time: 0.0156250, Kernel Time: 0.0312500

Hi,

the latest version (uv 0.2.15 (bfc342da9 2024-06-24)) still has these issues. We see this on a certain percentage every on our Windows CI runners. They do have CrowdStrike messing with our workloads unfortunately - corporate policy 😢

The common denominator seems to be source distributions which uv tries to build wheels from. I’ve never seen this error for packages that are available as wheel.

Hypothesis: snakeoil scanners need more time to scan compressed archives (because of the decompression step) and uvs backoff algorithm just needs a little tweaking to accommodate for that.

A few source distribution only packages: fire, odfpy, mapdata, pywinusb

A bunch of error messages for these packages
$ .\hatch.exe run all.py$INTERPRETER_VERSION`:cov
Creating environment: all.py3.11
Installing project
error: Failed to download and build `pywinusb==0.4.2`
  Caused by: Failed to write to the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmp3V6aqK\built-wheels-v3\.tmpsxHt5d\pywinusb-0.4.2 to \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmp3V6aqK\built-wheels-v3\index\70e6dbc41e17fe7c\pywinusb\0.4.2\w4S16F7Zw7fjYe2QmhqM_\pywinusb-0.4.2.zip
  Caused by: Access is denied. (os error 5)
  
$ .\hatch.exe run all.py$INTERPRETER_VERSION`:cov
Creating environment: all.py3.9
Installing Python distribution: 3.9
Installing project
Checking dependencies
Syncing dependencies
error: Failed to download and build `odfpy==1.4.1`
  Caused by: Failed to write to the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmp30woUu\built-wheels-v3\.tmp7d4zhJ\odfpy-1.4.1 to \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmp30woUu\built-wheels-v3\index\70e6dbc41e17fe7c\odfpy\1.4.1\J27cgvxiwwWDBSM2Tnauu\odfpy-1.4.1.tar.gz
  Caused by: Access is denied. (os error 5)

$ hatch run uv --version
Creating environment: default
Installing Python distribution: 3.11
Installing project in development mode
Checking dependencies
Syncing dependencies
error: Failed to download and build `mapdata==3.11.1`
  Caused by: Failed to write to the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmptBDtnM\built-wheels-v3\.tmpqFOiKl\mapdata-3.11.1 to \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmptBDtnM\built-wheels-v3\index\70e6dbc41e17fe7c\mapdata\3.11.1\T7WG4FPsti03XVV0KCULn\mapdata-3.11.1.tar.gz
  Caused by: Access is denied. (os error 5)

$ hatch run uv --version
Creating environment: default
Installing Python distribution: 3.11
Installing project in development mode
Checking dependencies
Syncing dependencies
error: Failed to download and build `fire==0.6.0`
  Caused by: Failed to write to the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmpVXpz23\built-wheels-v3\.tmpnCevMt\fire-0.6.0 to \\?\C:\Users\gitlabwinrunner\AppData\Local\Temp\.tmpVXpz23\built-wheels-v3\index\70e6dbc41e17fe7c\fire\0.6.0\pD3XrlBXA8_x3S3TYSW2o\fire-0.6.0.tar.gz
  Caused by: Access is denied. (os error 5)

This will take some trial and error. I’ll add some improvements in the next release, and then look to folks in this thread for testing.

Oh, yes, happy if this is handled by uv

I just don’t want to write a bash script on my end to retry the installation till it works

That’s interesting - though retrying multiple times sort of defeats the purpose of UV being so fast.

I wonder why pip success but UV fails.

(Note we do use an antivirus)

I think the effect on speed would be imperceptible to the end user. The uv speed up is more to do with dependency resolution and retrying is to deal with likely milliseconds of time that a security layer on Windows locks access to the extracted zip contents before uv can read and copy the data from the tmp folder to the archive

The overall approach is: unzip into a temporary folder, then move that folder into the cache to persist it. (This avoids persisting incomplete downloads that may error partway through.)

Just to add some more context to this, I get the same error and it will fail on different packages on each attempt if running uv clean in between

(.venv) PS C:\Program Files\envs\naduv> uv pip install ipython

Resolved 16 packages in 1.68s

error: Failed to download distributions
  Caused by: Failed to fetch wheel: prompt-toolkit==3.0.43
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Program Files\envs\pipx\venvs\venvs\uv\uvcache\.tmpvKXHjN to \\?\C:\Program Files\envs\pipx\venvs\venvs\uv\uvcache\archive-v0\VF2P3BmAtyIqJo8V9e9Jb
  Caused by: Access is denied. (os error 5)

(.venv) PS C:\Program Files\envs\naduv> uv clean

Clearing cache at: C:\Program Files\envs\pipx\venvs\venvs\uv\uvcache
Removed 369 files (3.6MiB)

(.venv) PS C:\Program Files\envs\n\n\n\naduv> uv pip install ipython

Resolved 16 packages in 1.77s

error: Failed to download distributions
  Caused by: Failed to fetch wheel: pygments==2.17.2
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Program Files\envs\pipx\venvs\venvs\uv\uvcache\.tmpA8BLxj to \\?\C:\Program Files\envs\pipx\venvs\venvs\uv\uvcache\archive-v0\xoGgYMWlHY-hrr7FtBrhm
  Caused by: Access is denied. (os error 5)

I suspect something in the temp file naming is randomly causing issues and after I tried 5 times with “uv clean” in-between it finished but it is happening frequently enough that there is a real issue. I am using the latest uv release 0.15 at the time of posting this issue

That appears to be a different error. This isn’t about the particular package distributions. This appears to be very specifically just an error somewhere in the renaming of folders.

Just tried using a requirements file off the shelf: https://github.com/google-research/kubric/blob/main/requirements.txt

I’ve added the full log including retries this time, showing how it’s not always the same package, and retries will eventually succeed. (Also generating 300+MB of trash in the leftover .tmp[______] folders in C:\Users\[____]\AppData\Local\uv\cache)

Subsequent installs are fine after the first install (and fast!), as everything is already in the cache.

Contrasted with regular Python pip, which installs first try, with or without cache.

PS C:\dev\uv_test_uv> uv venv; .\.venv\Scripts\activate.ps1; uv pip install -r requirements.txt
Using Python 3.11.6 interpreter at C:\dev\uv_test_uv\.venv\Scripts\python.exe
Creating virtualenv at: .venv
Resolved 136 packages in 31.02s
error: Failed to download distributions
  Caused by: Failed to fetch wheel: regex==2023.12.25
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpXU7l5Y to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\IPIdPmnxfhPlAbb4aByib
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 216ms
   Built dill==0.3.1.1
error: Failed to download distributions
  Caused by: Failed to fetch wheel: fastavro==1.9.4
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpvibAxB to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\xESJmy5hSHMPWyOAki-mV
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 202ms
   Built crcmod==1.7
error: Failed to download distributions
  Caused by: Failed to unzip wheel: crcmod==1.7
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpuSxG40 to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\8seE9kMwlOJb0FO7kkUiO
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 168ms
   Built hdfs==2.7.3
   Built docopt==0.6.2
   Built promise==2.3
   Built pyjsparser==2.7.1
   Built cloudml-hypertune==0.1.0.dev6
error: Failed to download distributions
  Caused by: Failed to fetch wheel: rapidfuzz==3.6.1
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpnchaw9 to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\fslC-i4Ih5c8itkG3OCU1
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 199ms
   Built google-apitools==0.5.31
error: Failed to download distributions
  Caused by: Failed to fetch wheel: scikit-learn==1.4.1.post1
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpyPARfj to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\BTqIbBmeNiUJZ4iFLjvr5
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 187ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: scikit-learn==1.4.1.post1
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpQ9zLLc to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\N6_d31F0MmeWfay8zuoy1
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 198ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: pyarrow==11.0.0
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpoDjYqG to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\77wbDpLZdJXaCe7d8Bgl4
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 180ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: scipy==1.12.0
  Caused by: Failed to read from the distribution cache
  Caused by: failed to rename file from \\?\C:\Users\[____]\AppData\Local\uv\cache\.tmpJrQ1Eo to \\?\C:\Users\[____]\AppData\Local\uv\cache\archive-v0\oJCgnzumPreaL33Y2A_jb
  Caused by: Access is denied. (os error 5)
(.venv) PS C:\dev\uv_test_uv> uv pip install -r requirements.txt
Resolved 136 packages in 193ms
Downloaded 3 packages in 1m 30s
Installed 136 packages in 41.33s
 + absl-py==1.4.0
 + apache-beam==2.54.0
 + astunparse==1.6.3
 + attrs==23.2.0
 + bidict==0.23.0
 + cachetools==5.3.2
 + certifi==2024.2.2
 + charset-normalizer==3.3.2
 + click==8.1.7
 + cloudml-hypertune==0.1.0.dev6
 + cloudpickle==2.2.1
 + colorama==0.4.6
 + crcmod==1.7
 + dataclasses==0.6
 + deprecated==1.2.14
 + dill==0.3.1.1
 + dm-tree==0.1.8
 + dnspython==2.5.0
 + docopt==0.6.2
 + etils==1.7.0
 + fastavro==1.9.4
 + fasteners==0.19
 + flatbuffers==23.5.26
 + fsspec==2024.2.0
 + gast==0.5.4
 + google-api-core==2.17.1
 + google-apitools==0.5.31
 + google-auth==2.28.0
 + google-auth-httplib2==0.1.1
 + google-auth-oauthlib==1.2.0
 + google-cloud-aiplatform==1.42.0
 + google-cloud-bigquery==3.17.2
 + google-cloud-bigquery-storage==2.24.0
 + google-cloud-bigtable==2.23.0
 + google-cloud-core==2.4.1
 + google-cloud-datastore==2.19.0
 + google-cloud-dlp==3.15.1
 + google-cloud-language==2.13.1
 + google-cloud-pubsub==2.19.4
 + google-cloud-pubsublite==1.9.0
 + google-cloud-recommendations-ai==0.10.8
 + google-cloud-resource-manager==1.12.1
 + google-cloud-spanner==3.42.0
 + google-cloud-storage==2.14.0
 + google-cloud-videointelligence==2.13.1
 + google-cloud-vision==3.7.0
 + google-crc32c==1.5.0
 + google-pasta==0.2.0
 + google-resumable-media==2.7.0
 + googleapis-common-protos==1.62.0
 + grpc-google-iam-v1==0.13.0
 + grpc-interceptor==0.15.4
 + grpcio==1.60.1
 + grpcio-status==1.60.1
 + h5py==3.10.0
 + hdfs==2.7.3
 + httplib2==0.22.0
 + idna==3.6
 + imageio==2.34.0
 + importlib-resources==6.1.1
 + joblib==1.3.2
 + js2py==0.74
 + jsonpickle==3.0.2
 + jsonschema==4.21.1
 + jsonschema-specifications==2023.12.1
 + keras==2.15.0
 + levenshtein==0.25.0
 + libclang==16.0.6
 + markdown==3.5.2
 + markupsafe==2.1.5
 + ml-dtypes==0.2.0
 + munch==4.0.0
 + numpy==1.24.4
 + oauth2client==4.1.3
 + oauthlib==3.2.2
 + objsize==0.7.0
 + opt-einsum==3.3.0
 + orjson==3.9.14
 + overrides==7.7.0
 + packaging==23.2
 + pandas==2.2.0
 + pillow==10.2.0
 + promise==2.3
 + proto-plus==1.23.0
 + protobuf==4.25.3
 + psutil==5.9.8
 + pyarrow==11.0.0
 + pyarrow-hotfix==0.6
 + pyasn1==0.5.1
 + pyasn1-modules==0.3.0
 + pydot==1.4.2
 + pyjsparser==2.7.1
 + pymongo==4.6.1
 + pyparsing==3.1.1
 + pypng==0.20220715.0
 + pyquaternion==0.9.9
 + python-dateutil==2.8.2
 + python-levenshtein==0.25.0
 + pytz==2024.1
 + rapidfuzz==3.6.1
 + referencing==0.33.0
 + regex==2023.12.25
 + requests==2.31.0
 + requests-oauthlib==1.3.1
 + rpds-py==0.18.0
 + rsa==4.9
 + scikit-learn==1.4.1.post1
 + scipy==1.12.0
 + setuptools==69.1.0
 + shapely==2.0.3
 + singledispatchmethod==1.0
 + six==1.16.0
 + sqlparse==0.4.4
 + tensorboard==2.15.2
 + tensorboard-data-server==0.7.2
 + tensorflow==2.15.0
 + tensorflow-datasets==4.9.4
 + tensorflow-estimator==2.15.0
 + tensorflow-intel==2.15.0
 + tensorflow-io-gcs-filesystem==0.31.0
 + tensorflow-metadata==1.13.1
 + termcolor==2.4.0
 + threadpoolctl==3.3.0
 + toml==0.10.2
 + tqdm==4.66.2
 + traitlets==5.14.1
 + trimesh==4.1.3
 + typing-extensions==4.9.0
 + tzdata==2024.1
 + tzlocal==5.2
 + urllib3==2.2.0
(.venv) PS C:\dev\uv_test_uv>