Solve – urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate is a Python error which occurs because python’s OpenSSL does not use the system certificate store.

In this article I am going to solve the error while I try explaining why the error is popping up in the first place, I will also introduce some solutions which worked for other developers and we will see if those solutions can solve the error in your unique situation.

Explaining the Error : urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

First of all we need to understand why the error happens at all,

The error happens in Python 3.6 on MacOS because it has an embedded version of OpenSSL, which does not use the system certificate.

Here is an example of the message of the error.

certificate verify failed unable to get local issuer certificate-problem-banner

Bellow we will take care of the error using multiple possible solutions according to your needs.

Solution 1 : edit the .pem file

The first solution is for Linux users.

Navigate to the path bellow on your Linux machine

certificate verify failed unable to get local issuer certificate-problem-banner-1

We will try to edit the .pem file by adding your public certificate. Your public certificate is inside the .pem file provided by your ssl certificate provider.

This solution should be enough but we still have other solutions in case this one does not work.

Solution 2 : use the command line to install the Certificates.command

The second solution is to use the command line to install the Certificates.command.

Start by opening the command line as admin, then run the command bellow.

certificate verify failed unable to get local issuer certificate-problem-banner-2

This solution should be enough. The error above was hard to deal with, I spent hours looking for a proper solution or set of solutions. I hope the solution above helped you.

Summing-up

Finally, we are at the end of this article, I hope this article has been helpful, I hope you solved the error : urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate , coding can be hard when you have a lot of confusing errors here and there. Thank you for reading, keep learning and keep coding, cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/