Python / Python
Python SSL: certificate verify failed
Fix Python SSL certificate verification failures in pip, requests, urllib, and API clients.
- Category
- Python
- Error signature
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed- Quick fix
- Update certifi and your system certificates, then retry the Python command.
- Updated
What this error means
Python raised CERTIFICATE_VERIFY_FAILED because it could not build a trusted TLS certificate chain for the server it contacted.
Common causes
- The local CA bundle is outdated.
- A proxy or antivirus tool intercepts HTTPS traffic with a custom certificate.
- The server certificate is expired, incomplete, or issued for a different hostname.
- Your machine clock is wrong, making a valid certificate appear expired or not yet valid.
Quick fixes
-
Upgrade Python certificate packages:
python -m pip install --upgrade pip certifi -
Check your system date and time.
-
If you are on a corporate network, install the organization root certificate through the approved system process.
-
Retry the command.
Step-by-step troubleshooting
- Identify whether the failure happens in
pip,requests,urllib, or a specific SDK. - Visit the target URL in a browser and inspect the certificate chain.
- Run the command from a different network to check whether a proxy is involved.
- Update operating system certificate bundles.
- Configure the client to use the correct trusted CA bundle instead of disabling verification.
Related errors
pip is configured with locations that require TLS/SSLrequests.exceptions.SSLErrorcertificate has expired
FAQ
Should I set verify=False?
Only as a temporary local diagnostic. Disabling TLS verification hides real security problems and should not be committed.
Why does the browser work but Python fails?
Browsers and Python may use different certificate stores, especially on custom Python installations.
Can this be caused by the server?
Yes. The server may be missing an intermediate certificate or serving a certificate for the wrong hostname.