uv: uv pip install from private extra index url get 401 Unauthorized

Summary

Hey guys, I’m really surprised to have that bug since it occured a year ago and from the discussion I saw, a fix has been implemented but I am still getting this issue. I just started using uv couple of weeks ago and I am doing some deep tests to be sure it works well and to replace poetry by uv. Here is the thing: I am trying to install private package in private azure pypi but I am getting the famous 401 unauthorized. Here is the full verbose anonymized:

> uv pip install my-package==17.0.2 --extra-index-url https://username:password@my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server --verbose
DEBUG uv 0.7.2 (481d05d8d 2025-04-30)
DEBUG Searching for default Python interpreter in virtual environments
DEBUG Found `cpython-3.10.4-windows-x86_64-none` at `C:\Users\user\Documents\Project\uvPip_demo\.venv\Scripts\python.exe` (virtual environment)   
DEBUG Using Python 3.10.4 environment at: .venv
DEBUG Acquired lock for `.venv`
DEBUG At least one requirement is not satisfied: my-package==17.0.2
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.10.4
DEBUG Solving with target Python version: >=3.10.4
DEBUG Adding direct dependency: my-package>=17.0.2, <17.0.2+
DEBUG Acquired lock for `C:\Users\user\AppData\Local\uv\cache\simple-v15\index\some-index\my-package.lock`
DEBUG Found stale response for: https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/
DEBUG Sending revalidation request for: https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/
DEBUG Found modified response for: https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/
DEBUG Released lock at `C:\Users\user\AppData\Local\uv\cache\simple-v15\index\some-index\my-package.lock`
DEBUG Searching for a compatible version of my-package (>=17.0.2, <17.0.2+)
DEBUG Selecting: my-package==17.0.2 [compatible] (my-package-17.0.2-py3-none-any.whl)
DEBUG Acquired lock for `C:\Users\user\AppData\Local\uv\cache\wheels-v5\index\some-index\my-package\my-package-17.0.2-py3-none-any.lock`
DEBUG No cache entry for: http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my-package-17.0.2-py3-none-any.whl
WARN Range requests not supported for my-package-17.0.2-py3-none-any.whl; streaming wheel
DEBUG No cache entry for: http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my-package-17.0.2-py3-none-any.whl
DEBUG No netrc file found
DEBUG Released lock at `C:\Users\user\AppData\Local\uv\cache\wheels-v5\index\some-index\my-package\my-package-17.0.2-py3-none-any.lock`
DEBUG Released lock at `C:\Users\user\Documents\Project\uvPip_demo\.venv\.lock`
error: Failed to fetch: `http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my-package-17.0.2-py3-none-any.whl`
 Caused by: HTTP status client error (401 Unauthorized) for url (https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my-package-17.0.2-py3-none-any.whl)

Platform

windows 11 x64

Version

0.7.2

Python version

3.10.4

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

We checked with my MLE colleague and it seems like pip sends only GET while uv sends a HEAD on top of GET, and you were right, our private server does not support HEAD yet. We we are going to update our private repo so it supports HEAD also to be able to use uv.

I confirm both points are happening i.e.:

  • pip install your-package --index-url your-url succeeds.
  • uv pip install your-package --default-index your-url fails.

Here is now the uv pip install with -vv

>uv pip install my-password --default-index https://username:password@my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server -vv

uv pip install my-package --default-index https://username:password@my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server  -vv       
DEBUG uv 0.7.2 (481d05d8d 2025-04-30)
DEBUG Searching for default Python interpreter in virtual environments
TRACE Cached interpreter info for Python 3.10.4, skipping probing: .venv\Scripts\python.exe
DEBUG Found `cpython-3.10.4-windows-x86_64-none` at `C:\Users\myusername\Documents\Project\uvPip_demo\.venv\Scripts\python.exe` (virtual environment)
DEBUG Using Python 3.10.4 environment at: .venv
TRACE Checking lock for `.venv` at `.venv\.lock`
DEBUG Acquired lock for `.venv`
DEBUG At least one requirement is not satisfied: my-package
TRACE Caching credentials for https://username:password@my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.10.4
DEBUG Solving with target Python version: >=3.10.4
TRACE Assigned packages: 
TRACE Chose package for decision: root. remaining choices:
DEBUG Adding direct dependency: my-package*
TRACE Assigned packages: root==0a0.dev0
TRACE Chose package for decision: my-package. remaining choices:
TRACE Fetching metadata for my-package from https://username:password@my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/
TRACE Checking lock for `C:\Users\myusername\AppData\Local\uv\cache\simple-v15\index\e626436b82ae0732\my-package.lock` at `C:\Users\myusername\AppData\Local\uv\cache\simple-v15\index\e626436b82ae0732\my-package.lock`
DEBUG Acquired lock for `C:\Users\myusername\AppData\Local\uv\cache\simple-v15\index\e626436b82ae0732\my-package.lock`
TRACE Cached request https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/ is storable because its response has a heuristically cacheable status code 200
TRACE Could not determine freshness lifetime, assuming none exists
TRACE Cached request https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/ has a cached response that does not allow staleness
TRACE Request https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/ does not have a fresh cache because its age is 41 seconds, it is greater than the freshness lifetime of 0 seconds and stale cached responses are not allowed
DEBUG Found stale response for: https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/
DEBUG Sending revalidation request for: https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/
TRACE Handling request for https://username:****@my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/ with authentication policy auto
TRACE Request for https://username:****@my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/ already contains username and password
TRACE Updating cached credentials for https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/ to Basic { username: Username(Some("username")), password: Some(****) }
TRACE Resource is modified because status is 200 and not 304
DEBUG Found modified response for: https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/
TRACE Cached request https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/ is storable because its response has a heuristically cacheable status code 200
DEBUG Released lock at `C:\Users\myusername\AppData\Local\uv\cache\simple-v15\index\e626436b82ae0732\my-package.lock`
TRACE Received package metadata for: my-package
TRACE Selecting candidate for my-package with range * with 30 remote versions
TRACE Found candidate for package my-package with range * after 1 steps: 18.0.1 version
TRACE Returning candidate for package my-package with range * after 1 steps
DEBUG Searching for a compatible version of my-package (*)
TRACE Selecting candidate for my-package with range * with 30 remote versions
TRACE Found candidate for package my-package with range * after 1 steps: 18.0.1 version
TRACE Returning candidate for package my-package with range * after 1 steps
DEBUG Selecting: my-package==18.0.1 [compatible] (my_package-18.0.1-py3-none-any.whl)
TRACE Checking lock for `C:\Users\myusername\AppData\Local\uv\cache\wheels-v5\index\e626436b82ae0732\my-package\my_package-18.0.1-py3-none-any.lock` at `C:\Users\myusername\AppData\Local\uv\cache\wheels-v5\index\e626436b82ae0732\my-package\my_package-18.0.1-py3-none-any.lock`
DEBUG Acquired lock for `C:\Users\myusername\AppData\Local\uv\cache\wheels-v5\index\e626436b82ae0732\my-package\my_package-18.0.1-py3-none-any.lock`
TRACE No cache entry exists for C:\Users\myusername\AppData\Local\uv\cache\wheels-v5\index\e626436b82ae0732\my-package\18.0.1-py3-none-any.msgpack
DEBUG No cache entry for: http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Sending fresh HEAD request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Handling request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl with authentication policy auto
TRACE Request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl is unauthenticated, checking cache
TRACE No credentials in cache for URL http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Attempting unauthenticated request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Considering retry of error: Error { kind: WrappedReqwestError(Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("my-azure-endpoint.northeurope.cloudapp.azure.com")), port: None, path: "/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl", query: None, fragment: None }, WrappedReqwestError(Reqwest(reqwest::Error { kind: Status(405), url: "https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl" }))) }
TRACE Cannot retry error: not an IO error
WARN Range requests not supported for my_package-18.0.1-py3-none-any.whl; streaming wheel
TRACE No cache entry exists for C:\Users\myusername\AppData\Local\uv\cache\wheels-v5\index\e626436b82ae0732\my-package\18.0.1-py3-none-any.msgpack
DEBUG No cache entry for: http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Sending fresh GET request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Handling request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl with authentication policy auto
TRACE Request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl is unauthenticated, checking cache
TRACE No credentials in cache for URL http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Attempting unauthenticated request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl
TRACE Request for http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl failed with 401 Unauthorized, checking for credentials
TRACE No credentials in cache for realm http://my-azure-endpoint.northeurope.cloudapp.azure.com
DEBUG No netrc file found
TRACE Considering retry of error: Error { kind: WrappedReqwestError(Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("my-azure-endpoint.northeurope.cloudapp.azure.com")), port: None, path: "/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl", query: None, fragment: None }, WrappedReqwestError(Reqwest(reqwest::Error { kind: Status(401), url: "https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl" }))) }
TRACE Cannot retry error: not an IO error
DEBUG Released lock at `C:\Users\myusername\AppData\Local\uv\cache\wheels-v5\index\e626436b82ae0732\my-package\my_package-18.0.1-py3-none-any.lock`
DEBUG Released lock at `C:\Users\myusername\Documents\Project\uvPip_demo\.venv\.lock`
error: Failed to fetch: `http://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl`
  Caused by: HTTP status client error (401 Unauthorized) for url (https://my-azure-endpoint.northeurope.cloudapp.azure.com/pypi-server/my-package/my_package-18.0.1-py3-none-any.whl)```