Created
November 8, 2020 23:23
-
-
Save davedavis/407abbd3800c6d31771b8ac93f9bc2fe to your computer and use it in GitHub Desktop.
How to fix Python urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1124)>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OK, after a lot of heartache, I've solve this. As usual, the solution was painfully simple. | |
Certifi uses it's own bundled certificate bundle, so you can use the one from here: https://curl.haxx.se/ca/cacert.pem | |
Basically, download it (or use your own from the certifi dist directory) | |
Then, set the env variable (in /etc/envirnoment if you're on Ubuntu like me) for $SSL_CERT_FILE to the one you downloaded: | |
export SSL_CERT_FILE=/home/yourname/cacert.pem | |
Worked immediately from main system CLI. I had to uninstall PyCharm and reinstall it for it to pick up the env variable and start working in virtualenvs again. | |
Sources: https://access.redhat.com/articles/2039753#troubleshooting-certificate-verification-8 and https://stackoverflow.com/users/6451573/jean-fran%c3%a7ois-fabre |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment