pip network_error ai_generated true

pip._vendor.urllib3.exceptions.MaxRetryError: Could not fetch URL: There was a problem confirming the ssl certificate

ID: pip/ssl-error

Also available as: JSON · Markdown
87%Fix Rate
90%Confidence
50Evidence
2022-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
24 active

Root Cause

SSL certificate verification failed when connecting to PyPI or custom index. Usually caused by corporate MITM proxy injecting its own certificate, outdated system CA certificates, or custom index with self-signed cert.

generic

Workarounds

  1. 85% success Update system CA certificates
    apt-get update && apt-get install ca-certificates && update-ca-certificates
  2. 90% success Point pip to the corporate CA bundle: pip install --cert /path/to/corporate-ca.crt <package>
    pip config set global.cert /path/to/corporate-ca-bundle.crt && pip install <package>
  3. 88% success Set REQUESTS_CA_BUNDLE environment variable
    export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt && pip install <package>

Dead Ends

Common approaches that don't work:

  1. Use --trusted-host for all installs permanently 55% fail

    Disables SSL verification which is a security risk; does not fix the underlying certificate issue

  2. Downgrade to an older pip that is less strict about SSL 75% fail

    Older pip versions have security vulnerabilities; SSL strictness is intentional

Error Chain

Leads to:
Preceded by:
Frequently confused with: