python network_error ai_generated partial

ERROR: pip._vendor.urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

ID: python/pip-connection-reset-by-peer

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2025-10-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —

Root Cause

The remote server forcefully closed the TCP connection, often due to firewall, timeout, or server overload.

generic

中文

远程服务器强制关闭 TCP 连接,通常由于防火墙、超时或服务器过载。

Workarounds

  1. 70% success Use a retry mechanism with pip's --retries option
    Run: pip install --retries 5 package
  2. 80% success Use a different network or proxy
    Run: pip install --proxy http://proxy:port package

Dead Ends

Common approaches that don't work:

  1. Increasing pip's timeout with --default-timeout 80% fail

    The connection is reset, not timed out; timeout increase doesn't help.

  2. Using a VPN to change IP 60% fail

    May bypass some firewalls but not all; also adds latency.