407
pip
network_error
ai_generated
partial
WARNING: Retrying (Retry(total=0)) after connection broken by 'ProxyError': ('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required'))
ID: pip/network-proxy-authentication-407
85%Fix Rate
89%Confidence
1Evidence
2024-06-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| pip 24.2 | active | — | — | — |
| Python 3.12 | active | — | — | — |
| urllib3 2.2 | active | — | — | — |
Root Cause
pip is behind a corporate proxy that requires authentication, but the proxy credentials are missing or incorrect in the environment or pip configuration.
generic中文
pip 位于需要身份验证的企业代理后面,但环境或 pip 配置中缺少或错误的代理凭据。
Official Documentation
https://pip.pypa.io/en/stable/topics/configuration/#environment-variablesWorkarounds
-
90% success Set proxy with credentials in environment variables: 'set HTTP_PROXY=http://user:[email protected]:8080' and 'set HTTPS_PROXY=http://user:[email protected]:8080' on Windows, or export on Linux/Mac.
Set proxy with credentials in environment variables: 'set HTTP_PROXY=http://user:[email protected]:8080' and 'set HTTPS_PROXY=http://user:[email protected]:8080' on Windows, or export on Linux/Mac.
-
85% success Configure pip's proxy globally: 'pip config set global.proxy http://user:[email protected]:8080'
Configure pip's proxy globally: 'pip config set global.proxy http://user:[email protected]:8080'
-
75% success Use a proxy authentication helper like 'cntlm' to handle NTLM auth and set HTTP_PROXY to localhost:3128.
Use a proxy authentication helper like 'cntlm' to handle NTLM auth and set HTTP_PROXY to localhost:3128.
中文步骤
在环境变量中设置带凭据的代理:Windows 上使用 'set HTTP_PROXY=http://user:[email protected]:8080' 和 'set HTTPS_PROXY=http://user:[email protected]:8080',Linux/Mac 上使用 export。
全局配置 pip 的代理:'pip config set global.proxy http://user:[email protected]:8080'
使用代理身份验证助手如 'cntlm' 处理 NTLM 认证,并将 HTTP_PROXY 设置为 localhost:3128。
Dead Ends
Common approaches that don't work:
-
95% fail
Setting HTTP_PROXY and HTTPS_PROXY without credentials still fails with 407; authentication is required.
-
70% fail
Disabling proxy detection with '--proxy ""' may work only if the machine has direct internet access, but often fails in corporate networks.
-
98% fail
Using 'pip install --trusted-host pypi.org' bypasses SSL checks but does not solve proxy authentication.