python network_error ai_generated true

ERROR: Exception: Traceback (most recent call last): ... pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

ID: python/pip-read-timeout-pypi

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-06-11First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

The network connection to files.pythonhosted.org is too slow or unstable, so pip's default read timeout elapses before a wheel finishes downloading.

generic

中文

到 files.pythonhosted.org 的网络连接过慢或不稳定,导致 pip 的默认读取超时在 wheel 下载完成前就已耗尽。

Workarounds

  1. 90% success
    Run pip install --timeout 120 <pkg>, or set PIP_DEFAULT_TIMEOUT=120 in the environment.
  2. 93% success
    Run pip install -i https://pypi.tuna.tsinghua.edu.cn/simple <pkg> (or another regional mirror).
  3. 88% success
    Use curl -O https://files.pythonhosted.org/.../pkg.whl then pip install ./pkg.whl.

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Retries help with transient failures but do not extend the per-read timeout.

  2. 90% fail

    Cache is unrelated to network timeout.

  3. 95% fail

    Prereleases do not fix network latency.