python network_error ai_generated true

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x...>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/requests/

ID: python/pip-index-url-connection-timeout

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-02-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

Network egress to pypi.org is blocked or slow (firewall, VPN, DNS), so each connection attempt times out before the HTTP handshake completes.

generic

中文

到 pypi.org 的网络出口被阻止或较慢(防火墙、VPN、DNS),因此每次连接尝试在 HTTP 握手完成前就超时。

Workarounds

  1. 92% success
    export PIP_INDEX_URL=https://mirror.corp.example/simple
    export PIP_TRUSTED_HOST=mirror.corp.example
    python -m pip install requests
  2. 88% success
    export HTTPS_PROXY=http://proxy.corp.example:3128
    export HTTP_PROXY=http://proxy.corp.example:3128
    python -m pip install requests

Dead Ends

Common approaches that don't work:

  1. 80% fail

    If the host is unreachable, a longer timeout just makes the failure slower.

  2. 85% fail

    More retries on a blocked route amplify the delay without success.