# pip "WARNING: Retrying ... after connection broken" in CI

> Fix pip "WARNING: Retrying ... after connection broken" in CI - transient network drops reaching PyPI. Add retries and a cache so they stop failing.

Source: https://latchkey.dev/learn/python/pip-retrying-connection-broken-urllib3  
Updated: 2026-06-25

pip’s underlying urllib3 retried a request after the connection to PyPI dropped. These warnings are transient network failures; the install often recovers on its own or on a re-run.

## Diagnose it: which Python, and which index?

A pip failure in CI is usually about the interpreter or the index rather than the package. Runners have several Pythons installed, and the one on PATH is not necessarily the one your virtualenv or your workflow selected.

```Terminal
which -a python python3 pip pip3
python -c "import sys; print(sys.executable, sys.version)"
pip config list
pip debug --verbose 2>/dev/null | grep -i "compatible tags" | head -5
```

> Compatible tags decide whether a wheel is usable. A package that installs from a wheel on your machine and builds from source in CI is a tag mismatch, and the resulting failure is a compiler error rather than a pip error.

## FAQ

### What causes pip "WARNING: retrying ... after connection broken" in CI?

There are 2 common causes: transient connectivity or dns blip and an overloaded or rate-limiting mirror. A brief network drop or DNS failure (Temporary failure in name resolution) breaks the connection.

### How do I fix pip "WARNING: retrying ... after connection broken" in CI?

There are 3 fixes depending on which cause you have: raise retries and timeout, cache wheels so retries matter less, and check dns/proxy if it persists. Work through them in order, since the first is the most common.

### What does pip "WARNING: retrying ... after connection broken" in CI actually mean?

pip prints repeated "WARNING: Retrying ...

### How do I stop pip "WARNING: retrying ... after connection broken" in CI happening again?

Set PIP_RETRIES/PIP_DEFAULT_TIMEOUT for resilience in CI. The prevention section lists 3 changes that keep it from recurring.

### Can Latchkey fix this automatically?

Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
