uv icon indicating copy to clipboard operation
uv copied to clipboard

uv install python on Windows fails during archive extraction

Open mrijken opened this issue 1 year ago • 3 comments

If I call uv python install 3.12 on W11 with uv 0.3.0, I get:

Searching for Python versions matching: Python 3.12
cpython-3.12.5-windows-x86_64-none ------------------------------ 4.47 MB/23.57 MB
error: Failed to install cpython-3.12.5-windows-x86_64-none: Failed to extract archive: cpython-3.12.5%2B20240814-x86_64-pc-windows-msvc-install_only_stripped.tar.gz

I tried it multiple times and every time I get the same issue. However when I add -vv to make it verbose, I will install without issues.

I could reproduce it for Python 3.11 also.

mrijken avatar Aug 21 '24 14:08 mrijken

After the retry, it works

image

pplmx avatar Aug 21 '24 14:08 pplmx

It might be antivirus, it can do weird things interrupting large zip files. cc @charliermarsh

zanieb avatar Aug 21 '24 15:08 zanieb

Running: uv python install 3.8.5 I get error:

Searching for Python versions matching: Python 3.8.5
cpython-3.8.5-windows-x86_64-none ------------------------------ 20.97 MB/32.45 MB                                                                               error: Failed to install cpython-3.8.5-windows-x86_64-none
  Caused by: Failed to extract archive: cpython-3.8.5-x86_64-pc-windows-msvc-shared-pgo-20200830T2254.tar.zst

I am using: uv 0.3.5 (6c62d9fbf 2024-08-27) On Windows 10. I re-ran the same command: uv python install 3.8.5 a second time and it worked with no other changes.

mikey-no avatar Aug 28 '24 09:08 mikey-no

I can confirm that this could be 'fixed' by just running multiple times. Third time was the charm in my case. Seems very believable to me that it was caused by some kind of corporate snake oil. Never saw the error on my private machines.

JonasR avatar Nov 07 '24 13:11 JonasR

We now retry these -- which may help? I'll close, but we can re-open if we get more reports.

charliermarsh avatar Nov 23 '24 03:11 charliermarsh

This still occurs in Windows 11. I tried with uv 0.7.x or uv 0.8.x.

uv python install --native-tls --install-dir C:\users\readacted\python 3.14
cpython-3.14.0b3-windows-x86_64-none (download) ------------------------------ 20.19 MiB/20.69 MiB                                                                                                               error: Failed to install cpython-3.14.0b3-windows-x86_64-none
  Caused by: Failed to extract archive: cpython-3.14.0b3-20250630-x86_64-pc-windows-msvc-install_only_stripped.tar.gz
  Caused by: failed to unpack `\\?\C:\Users\redacted\python\.temp\.tmpM4UCgj\python\vcruntime140_1.dll`
  Caused by: failed to unpack `python/vcruntime140_1.dll` into `\\?\C:\Users\redacted\python\.temp\.tmpM4UCgj\python\vcruntime140_1.dll`
  Caused by: error decoding response body
  Caused by: request or response body error
  Caused by: operation timed out

But strangely the workaround is to create a venv anywhere like so:

uv venv --native-tls --python=3.14 venv\py314

Confirm the python is now installed

uv python list
cpython-3.14.0b3-windows-x86_64-none                 AppData\Roaming\uv\python\cpython-3.14.0b3-windows-x86_64-none\python.exe
cpython-3.14.0b3+freethreaded-windows-x86_64-none    <download available>
cpython-3.13.5-windows-x86_64-none                   <download available>
[...]

Check if it works

AppData\Roaming\uv\python\cpython-3.14.0b3-windows-x86_64-none\python.exe
Python 3.14.0b3 (main, Jun 29 2025, 16:17:35) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

This may be as some pointed out due to Windows Defender on this particular machine, which is in a corporate environment. But why it works via the venv command then?

agilevic avatar Aug 06 '25 14:08 agilevic

Does this happen consistently, or only sporadically? If consistently, it's a different problem, either network or filesystem policy. In this case, please open a new issue. If it happens sporadically, we now track this is in https://github.com/astral-sh/uv/issues/14069.

konstin avatar Aug 06 '25 16:08 konstin