SSL: CERTIFICATE_VERIFY_FAILED in Python (pip, requests, urllib)
This error matches known, documented patterns with reliable solutions.
Quick Fix (Most Common Solution)
- For pip: use --trusted-host flags to bypass verification for PyPI servers temporarily
- For macOS Python from python.org: run Install Certificates.command in the Python app folder
Seeing "ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.
What This Error Means
Python cannot verify the SSL certificate of the server it is connecting to. The system's CA (Certificate Authority) bundle is outdated or missing, so Python rejects the HTTPS connection as untrusted.
Reported across multiple operating systems and devices.
Not affiliated with browser, OS, or device manufacturers.
New here? Learn why exact error messages matter →
Common Causes
- System CA certificates are outdated (very common on older macOS with Python from python.org)
- Python was installed without updating certificate authorities
- Corporate or office network uses a self-signed certificate for HTTPS inspection (SSL interception)
How to Fix
- For pip: use --trusted-host flags to bypass verification for PyPI servers temporarily
- For macOS Python from python.org: run Install Certificates.command in the Python app folder
- For the requests library: pass verify= with your CA certificate bundle path
- For a permanent fix across all Python HTTPS: pip install --upgrade certifi
Last reviewed: June 2026 How we review solutions
Didn't fix it? Get a personalised solution
Environment-Specific Commands
macOS — python.org install (most common cause)
# Open Finder > Applications > Python 3.x folder# Double-click: Install Certificates.commandpip install --upgrade certifi
All platforms — trusted hosts workaround for pip
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org [package-name]
All platforms — permanent fix via certifi upgrade
pip install --upgrade certifipython -c "import certifi; print(certifi.where())"
Quick Diagnostic Path
- If Error occurs on macOS with Python from python.org → Run 'Install Certificates.command' from /Applications/Python 3.x/ then retry
- If Error occurs on a corporate network → Get the corporate CA certificate from IT, then: pip install --cert /path/to/corp-ca.crt certifi
- If Error only in pip but browser HTTPS works → Browser uses system certificates; Python uses certifi. Run: pip install --upgrade certifi
If This Still Fails, Check
- Virtual environments: certifi must be installed inside the active venv — activate it first, then run pip install --upgrade certifi
- Conda environments: use 'conda update certifi' instead of pip to keep certificates in sync with conda's CA bundle
- Self-signed certs in development: set REQUESTS_CA_BUNDLE=/path/to/your-cert.pem as an environment variable so requests always uses it
Fix SSL certificate verification in Python
# Recommended permanent fix: upgrade certifi
pip install --upgrade certifi
# pip workaround (when certifi upgrade is not possible)
pip install --trusted-host pypi.org \
--trusted-host files.pythonhosted.org \
[package-name]
# requests library: use explicit CA bundle
import requests
requests.get("https://example.com", verify="/path/to/ca-bundle.crt")
# Verify fix
python -c "import urllib.request; urllib.request.urlopen('https://pypi.org')" && echo "SSL OK"Common Misdiagnoses
Common Misdiagnoses When Seeing Certificate Verify Failed Python
Certificate Verify Failed Python is frequently misattributed to the wrong cause because the error message describes the symptom — what failed — rather than the root cause — why it failed. Applying a fix based on the symptom without identifying the root cause leads to recurring errors.
The most reliable diagnostic approach is to work backwards from the error: identify what was happening when the error occurred (which operation, which component, which data), what changed recently (code, configuration, environment, dependencies, user input), and what the error message says exactly (not paraphrased). The exact error message text, including any numeric codes, stack trace line numbers, and accompanying log context, is necessary for accurate diagnosis. Searching for the exact error text (in quotes) returns results specific to your error, while paraphrased searches return results for all variations. For Certificate Verify Failed Python specifically, the most common misdiagnosis is assuming the most recently changed component is the cause — in reality, it may have exposed a pre-existing condition. Revert recent changes one at a time to identify which change triggered the error, then investigate why that change matters.Need reliable hosting?
DigitalOcean offers simple cloud infrastructure with $200 free credit for new users.
Try DigitalOcean →We may earn a commission from tools recommended in our fixes.
Optional follow-up
Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.
Was this explanation helpful?
Frequently Asked Questions
Is it safe to disable SSL verification (verify=False)?
No. Disabling verification makes your connection vulnerable to man-in-the-middle attacks. Only use verify=False as a temporary diagnostic step — never in production.
Why does this happen specifically on macOS?
Python installed from python.org on macOS does not use the macOS system keychain. It ships with its own CA bundle that must be updated by running 'Install Certificates.command' from the Python folder in Applications.
What is my corporate network doing to my SSL connections?
Corporate networks often perform SSL inspection (MITM). They replace server certificates with their own. Ask your IT team for the corporate CA certificate and add it to certifi.
Also Known As
- Error message
- System error
- Technical error
- Error code
Common Search Variations
- "how to fix this error"
- "what does this error mean"
- "error solution"
- "troubleshooting error"
- "error fix guide"
Related Errors
Still Stuck?
Paste a different error message or upload a screenshot to get help instantly.