# pip._vendor.urllib3.exceptions.ProtocolError：('连接中断：IncompleteRead（已读取 0 字节，预期还需 12345 字节）', IncompleteRead(...))

- **ID:** `python/pip-connection-broken-incompleteread`
- **领域:** python
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

下载连接在传输中途被代理、防火墙、不稳定网络或 CDN 边缘节点切断——pip 收到的字节数少于 Content-Length 承诺的数量。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (75% 成功率)
   ```
   pip install --timeout 120 --retries 10 <pkg>
   ```
2. **** (85% 成功率)
   ```
   pip download --no-deps <pkg> -d ./wheels
# or
curl -L --retry 5 -o ./wheels/<wheel> https://files.pythonhosted.org/...
pip install --no-index --find-links ./wheels <pkg>
   ```
3. **** (70% 成功率)
   ```
   pip install -i https://pypi.tuna.tsinghua.edu.cn/simple <pkg>
# or your org's mirror
   ```

## 无效尝试

- **** — Transient but recurs on large packages; wastes time and bandwidth. (70% 失败率)
- **** — The failure is a truncated body, not a certificate problem. (90% 失败率)
- **** — Doesn't address proxy/network truncation. (80% 失败率)
