maphew

uv packages fail with UnknownIssuer

PS D:\> uv run .\collect-stats.py

Reading inline script metadata from `collect-stats.py`
 × Failed to download `numpy==2.2.1`
 ├─▶ Failed to fetch:
...
 ├─▶ Request failed after 3 retries
 ├─▶ error sending request for url
...
 ├─▶ client error (Connect)
 ╰─▶ invalid peer certificate: UnknownIssuer

 

if you're relying on a corporate trust root (e.g., for a mandatory proxy) that's included in your system's certificate store. To instruct uv to use the system's trust store, run uv with the --native-tls command-line flag, or set the UV_NATIVE_TLS environment variable to true.

https://docs.astral.sh/uv/configuration/authentication/#custom-ca-certificates 

solution#

Permanent

setx UV_NATIVE_TLS true
refresh-EnvironmentVariables.ps1
uv run .\collect-stats.py
Reading inline script metadata from `collect-stats.py`
Installed 9 packages in 752ms
...etc

One time

uv --native-tls run ...