Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv ignore proxy exceptions on Windows #11640

Open
Fizcko opened this issue Feb 19, 2025 · 12 comments
Open

uv ignore proxy exceptions on Windows #11640

Fizcko opened this issue Feb 19, 2025 · 12 comments
Labels
bug Something isn't working external The problem is with another package or dependency (not uv)

Comments

@Fizcko
Copy link

Fizcko commented Feb 19, 2025

Summary

On Windows, in a corporate device the proxy exceptions defined in the proxy settings are ignored by uv.

Steps to reproduce

  1. With proxy enabled on OS settings

Proxy config

ip: 10.0.10.250
port: 8080
exceptions: *.myorg.local

uv config file %APPDATA%\uv\uv.toml to use custom index url:

[[index]]
url = "https://artifactory.myorg.local/simple"
default = true

Run uv command

> uv add flask
⠇ test-python==0.1.0                                                                                                                                        error: Failed to fetch: `https://artifactory.myorg.local/simple/flask/`
  Caused by: Request failed after 3 retries
  Caused by: error sending request for url (https://artifactory.myorg.local/simple/flask/)
  Caused by: client error (Connect)
  Caused by: proxy authentication required
>

Same command with verbose

> $env:RUST_LOG="uv=trace"
> uv add flask
DEBUG uv 0.6.2 (6d3614eec 2025-02-19)
DEBUG Found project root: `X:\Temp\test_python`
DEBUG No workspace root found, using project root
TRACE Checking lock for `X:\Temp\test_python` at `C:\Users\johndoe\AppData\Local\Temp\uv-b254de633360c559.lock`
DEBUG Acquired lock for `X:\Temp\test_python`
DEBUG Reading Python requests from version file at `X:\Temp\test_python\.python-version`
DEBUG Using Python request `3.11` from version file at `.python-version`
DEBUG Checking for Python environment at `.venv`
TRACE Cached interpreter info for Python 3.11.4, skipping probing: .venv\Scripts\python.exe
DEBUG The virtual environment's Python version satisfies `3.11`
DEBUG Released lock at `C:\Users\johndoe\AppData\Local\Temp\uv-b254de633360c559.lock`
DEBUG Using request timeout of 30s
DEBUG Found static `pyproject.toml` for: test-python @ file:///X:/Temp/test_python
DEBUG No workspace root found, using project root
TRACE Performing lookahead for test-python @ file:///X:/Temp/test_python
DEBUG Solving with installed Python version: 3.11.4
DEBUG Solving with target Python version: >=3.11
TRACE Assigned packages:
TRACE Chose package for decision: root. remaining choices:
DEBUG Adding direct dependency: test-python*
TRACE Assigned packages: root==0a0.dev0
TRACE Chose package for decision: test-python. remaining choices:
DEBUG Searching for a compatible version of test-python @ file:///X:/Temp/test_python (*)
DEBUG Adding direct dependency: flask*
TRACE Fetching metadata for flask from https://artifactory.myorg.local/simple/flask/
TRACE Assigned packages: root==0a0.dev0, test-python==0.1.0
TRACE Chose package for decision: flask. remaining choices:
TRACE Checking lock for `C:\Users\johndoe\AppData\Local\uv\cache\simple-v15\index\e03af8d8960669e8\flask.lock` at `C:\Users\johndoe\AppData\Local\uv\cache\simple-v15\index\e03af8d8960669e8\flask.lock`
DEBUG Acquired lock for `C:\Users\johndoe\AppData\Local\uv\cache\simple-v15\index\e03af8d8960669e8\flask.lock`
TRACE No cache entry exists for C:\Users\johndoe\AppData\Local\uv\cache\simple-v15\index\e03af8d8960669e8\flask.rkyv
DEBUG No cache entry for: https://artifactory.myorg.local/simple/flask/
TRACE Sending fresh GET request for https://artifactory.myorg.local/simple/flask/
TRACE Handling request for https://artifactory.myorg.local/simple/flask/
TRACE Request for https://artifactory.myorg.local/simple/flask/ is unauthenticated, checking cache
TRACE No credentials in cache for URL https://artifactory.myorg.local/simple/flask/
TRACE Attempting unauthenticated request for https://artifactory.myorg.local/simple/flask/
DEBUG Transient request failure for https://artifactory.myorg.local/simple/flask/, retrying: error sending request for url (https://artifactory.myorg.local/simple/flask/)
  Caused by: client error (Connect)
  Caused by: proxy authentication required
TRACE Handling request for https://artifactory.myorg.local/simple/flask/
TRACE Request for https://artifactory.myorg.local/simple/flask/ is unauthenticated, checking cache
TRACE No credentials in cache for URL https://artifactory.myorg.local/simple/flask/
TRACE Attempting unauthenticated request for https://artifactory.myorg.local/simple/flask/
DEBUG Transient request failure for https://artifactory.myorg.local/simple/flask/, retrying: error sending request for url (https://artifactory.myorg.local/simple/flask/)
  Caused by: client error (Connect)
  Caused by: proxy authentication required
TRACE Handling request for https://artifactory.myorg.local/simple/flask/
TRACE Request for https://artifactory.myorg.local/simple/flask/ is unauthenticated, checking cache
TRACE No credentials in cache for URL https://artifactory.myorg.local/simple/flask/
TRACE Attempting unauthenticated request for https://artifactory.myorg.local/simple/flask/
DEBUG Transient request failure for https://artifactory.myorg.local/simple/flask/, retrying: error sending request for url (https://artifactory.myorg.local/simple/flask/)
  Caused by: client error (Connect)
  Caused by: proxy authentication required
TRACE Handling request for https://artifactory.myorg.local/simple/flask/
TRACE Request for https://artifactory.myorg.local/simple/flask/ is unauthenticated, checking cache
TRACE No credentials in cache for URL https://artifactory.myorg.local/simple/flask/
TRACE Attempting unauthenticated request for https://artifactory.myorg.local/simple/flask/
DEBUG Transient request failure for https://artifactory.myorg.local/simple/flask/, retrying: error sending request for url (https://artifactory.myorg.local/simple/flask/)
  Caused by: client error (Connect)
  Caused by: proxy authentication required
TRACE Considering retry of error: Error { kind: WrappedReqwestError(Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("artifactory.myorg.local")), port: None, path: "/simple/flask/", query: None, fragment: None }, WrappedReqwestError(Middleware(Request failed after 3 retries

Caused by:
    0: error sending request for url (https://artifactory.myorg.local/simple/flask/)
    1: client error (Connect)
    2: proxy authentication required))) }
TRACE Cannot retry error: not an IO error
DEBUG Released lock at `C:\Users\johndoe\AppData\Local\uv\cache\simple-v15\index\e03af8d8960669e8\flask.lock`
DEBUG Reverting changes to `pyproject.toml`
DEBUG Removing `uv.lock`
error: Failed to fetch: `https://artifactory.myorg.local/simple/flask/`
  Caused by: Request failed after 3 retries
  Caused by: error sending request for url (https://artifactory.myorg.local/simple/flask/)
  Caused by: client error (Connect)
  Caused by: proxy authentication required
  1. With proxy disabled on OS settings
> uv add flask
Resolved 9 packages in 213ms
Prepared 8 packages in 342ms
░░░░░░░░░░░░░░░░░░░░ [0/8] Installing wheels...                                                                                                             warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 8 packages in 52ms
 + blinker==1.9.0
 + click==8.1.8
 + colorama==0.4.6
 + flask==3.1.0
 + itsdangerous==2.2.0
 + jinja2==3.1.5
 + markupsafe==3.0.2
 + werkzeug==3.1.3

Platform

Windows 10 & 11

Version

uv 0.6.2

Python version

python 3.11

@Fizcko Fizcko added the bug Something isn't working label Feb 19, 2025
@zanieb
Copy link
Member

zanieb commented Feb 19, 2025

Thanks for adding more details! I appreciate it.

How does the proxy configuration work? Where do you do that?

We don't read proxy setting directly, so we'll need to track support for this upstream in reqwest which implements the network stack we use.

@zanieb zanieb added the external The problem is with another package or dependency (not uv) label Feb 19, 2025
@Fizcko
Copy link
Author

Fizcko commented Feb 19, 2025

The proxy settings are directly set into windows

Image

Image

You can simulate one with CCProxy software

@Fizcko
Copy link
Author

Fizcko commented Feb 19, 2025

The linux equivalent would be:

export HTTP_PROXY="http://10.0.10.250:8080"
export HTTPS_PROXY="http://10.0.10.250:8080"
export NO_PROXY="*.myorg.local"

But I have not tested under Linux if the behavior was the same.

@zanieb
Copy link
Member

zanieb commented Feb 19, 2025

Thanks again!

I think this is the same as seanmonstar/reqwest#1444

Can you confirm that registry key is the relevant place this is stored?

@Fizcko
Copy link
Author

Fizcko commented Feb 19, 2025

Yes it is

Image

@zanieb
Copy link
Member

zanieb commented Feb 19, 2025

Thanks! I'll follow-up there and see if we can get this fixed.

@rv2931
Copy link

rv2931 commented Mar 4, 2025

Hi. I meet this issue too and this ticket confirm it is a bug/lack... It is important to know that proxy configuration is not only http_proxy/https_proxy, but no_proxy too and overall it is really important when you need it
Hope it will be fixed quite soon
Thanks to community

@zanieb
Copy link
Member

zanieb commented Mar 5, 2025

We're just waiting for the fix to be released upstream.

@rv2931
Copy link

rv2931 commented Mar 6, 2025

Okay. I was wondering about the impact of these bug, but for the moment blocking problem as I can't test or deploy anything on my deployement server as it can't access to internal ressource of my company (python package from internal gitlab instance) as UV pip try to get them from public internet
I will try to workaround the problem by installing our internal package via native pip that's work correctly, maybe filling the cache before UV sync and maybe UV will just use the cache ?

@Fizcko
Copy link
Author

Fizcko commented Mar 6, 2025

A fix have been push and merged.

As @zanieb said we are waiting for a new release of reqwest (above than v0.12.12).

@rv2931 as workaround (for now) you can use this:

exceptions: *.myorg.local;*.myneworg.local

Run this in a powershell command with comma separator and without *.

$env:no_proxy="myorg.local,myneworg.local"

@rv2931
Copy link

rv2931 commented Mar 6, 2025

Ok but I don't understand your workaround as it is the topic if the bug itself: no_proxy is not managed correctly by uv commands
So in addition I have the same problem on Linux during docker build based on Ubuntu: 22.04.
Installation with native pip is ok but not with iv sync "could 'ot resolve" so it is not linked specifically to windows version
I'm trying a workaround by unsettling http_proxy/https_proxy and using the uv sync --package <mylocal_gitlab_repository> then resetting the proxybbalue after for the other public packages

@zanieb
Copy link
Member

zanieb commented Mar 6, 2025

@rv2931 sounds like another issue? maybe #8450? This issue is specifically about Windows, hence the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external The problem is with another package or dependency (not uv)
Projects
None yet
Development

No branches or pull requests

3 participants