Luciano
Luciano

Reputation: 486

Pip install TLS CA issue

Every time I try to pip install something, this happens:

Lucianos-Mac:test luciano$ pip install torch
Collecting torch
Could not install packages due to an EnvironmentError: Could not find a suitable TLS CA certificate bundle, invalid path: /Users/luciano/Applications/NextGIS/Library/Frameworks/openssl.framework/Resources/ssl/certs/cert.pem

The path it references was created when I installed the gdal package from nextgis.com, which I later deleted, so the NextGIS directory does not exist. However, pip still looks there for a certificate and I don't know how to change this. I'm using Python 3.6 with Pip 19.0.3 on MacOS 10.14.

EDIT: env | grep cert outputs

SSL_CERT_FILE=/Users/luciano/Applications/NextGIS/Library/Frameworks/openssl.framework/Resources/ssl/certs/cert.pem
CURL_CA_BUNDLE=/Users/luciano/Applications/NextGIS/Library/Frameworks/openssl.framework/Resources/ssl/certs/cert.pem

unsetting these temporarily solve the problem, but when I restart the terminal, they are set again, and I don't know where.

Upvotes: 1

Views: 13452

Answers (3)

Dryland
Dryland

Reputation: 106

I had this problem after a failed attempt to install Docker. The process did have something to do with ca-certificates. So I install the package with

sudo apt install ca-certificates

and voila, things get back to normal again. Hope this help.

Upvotes: 0

Vladimir Kapustin
Vladimir Kapustin

Reputation: 36

Delete (or edit) these two files:

/Users/<user>/Library/LaunchAgents/setenv.CURL_CA_BUNDLE.plist
/Users/<user>/Library/LaunchAgents/setenv.SSL_CERT_FILE.plist

In the same folder NextGIS puts three other files that are setting ENV variables. I think they also should be taken care of.

Upvotes: 1

l&#39;L&#39;l
l&#39;L&#39;l

Reputation: 47189

You can trace the environment variable to wherever it gets set by:

$ PS4='+$BASH_SOURCE> ' BASH_XTRACEFD=7 bash -xl 2> ~/desktop/trace.log ; reset

Followed by Control + C

Then issue the following command:

$ grep REQUESTS_CA_BUNDLE ~/desktop/trace.log

It should return the location of where it's getting set within your environment.

Upvotes: 1

Related Questions