python network_error ai_generated true

ERROR: Could not install packages due to an SSLError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/package/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1006)')))

ID: python/pip-install-certificate-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-09-25First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

pip cannot verify the SSL certificate because the certificate chain includes a self-signed certificate, often due to a corporate proxy or antivirus software.

generic

中文

pip 无法验证 SSL 证书,因为证书链包含自签名证书,通常是由于企业代理或防病毒软件。

Workarounds

  1. 90% success
    pip install --cert /path/to/corporate-ca.pem package
  2. 85% success
    pip install --upgrade certifi; export SSL_CERT_FILE=$(python -m certifi)

Dead Ends

Common approaches that don't work:

  1. 50% fail

    Disables SSL verification, exposing you to MITM attacks; not a proper fix.

  2. 60% fail

    Globally disables HTTPS verification for Python, affecting all libraries; insecure.