Can I get around using "pip install --cert"?
Solution 1:
You can set that through the pip configuration file, which is in $HOME/.pip/pip.conf
or %APPDATA%\pip\pip.ini
on Windows:
[global]
cert = /usr/local/share/ca-certificate/mycert.crt
This file lets you set basically all the flags that are used by pip. Full documentation is at https://pip.pypa.io/en/latest/user_guide/#configuration
Solution 2:
For me, non of the config-file workarounds worked. I'm using pip 1.5.4 on Ubuntu 14.04
What eventually worked for me is installing the certificate on the system first (for me on ubuntu this would be)
sudo cp ~/my_cert.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
The previous automatically updates the bundle file (checking at the bottom of /etc/ssl/certs/ca-certificates.crt
you should now see the same certificate as in my_cert.crt
)
Now use that path in PIP_CERT
. And add it to my .bashrc
:
echo export PIP_CERT=/etc/ssl/certs/ca-certificates.crt >> ~/.bashrc
DISCLAIMER: I already posted this answer in SO (same answer as in the 'eventually duplicated link above', but at the beginning I didn't find the other (eventually duplicated answer)... so if someone like me gets here first, then this might help.
Maybe I'm breaking some kind of rules to post the same answer twice, one in SO and the other one in superuser. If so, sorry about that.
Solution 3:
This worked for me without needing to know where the config file lives:
python -m pip config set global.cert C:\\Path\\cert.crt
I believe you need pip version 10+, which you can find with:
python -m pip --version
The output of the config set command then outputs the name of the config file for your convenience