The problem
When I run pip install certifi
(or python -m pip install certifi) (pip2), I get the error
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)
or if I run pip3 install certifi
, I get the error
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:1000)
.
As a result I can’t pip install anything, not even the certifi package which some people have said can resolve this very type of error.
Information about my setup
- I am running MacOS Ventura 13.4.
- It has both a Python 2.7 and a Python 3.12 installation on it, as well as a brew install and a conda install, as I’m a Python developer and experiment with many things.
- There are various paths for ssl certs on my machine. I am aware of:
/usr/local/Cellar/ca-certificates/2024-07-02/share/ca-certificates/cacert.pem
~/ca_certs
— symbolic link to –>/usr/local/share/ca-certificates
/usr/local/share/ca-certificates
–> symbolic link to –>../Cellar/ca-certificates/2024-07-02/share/ca-certificates
/etc/ssl/cert.pem
/private/etc/ssl/cert.pem
- I believe my Python installation looks for certs here:
$ python -c 'import ssl; print(ssl.get_default_verify_paths().openssl_cafile)'
/Library/Frameworks/Python.framework/Versions/2.7/etc/openssl/cert.pem
(which I’ve symlinked to my cert file also) and similar for Python 3.
What I’ve tried
I’ve tried setting up symlinks so that all of these locations are pointing to the same cert file in the end.
I’ve tried following the solution detailed here which seemed very promising. I downloaded the latest Firefox certs and discovered they were the same as the ones I already had. Then I created the self-signed certificate as instructed, and added its contents to my cert.pem
file.
All to no avail. I just keep getting the same errors. And I really want to know why.
Thank you in advance for your help. In the meantime I’ll be trying to read more about the specific numbers 727
and 1000
to see if there is a more specific error message.