Home > Software design >  "There was a problem confirming the ssl certificate" when doing pip install on a local art
"There was a problem confirming the ssl certificate" when doing pip install on a local art

Time:03-11

I could use some guidance on what needs to be put in place for resolving this SSL issue to an artifactory server when running pip install. Is this "self signed certificate" supposed to be replaced by a specific one provided by that server?

Could not fetch URL [our.artifactory.server.name]/simple/hercl/: 
There was a problem confirming the ssl certificate: HTTPSConnectionPool
   (host='[our.artifactory.server.name]', port=443): 
Max retries exceeded with url: 
    /api/pypi/our.artifactory.server.name-local/simple/hercl/ (Caused by SSLError(SSLCertVerificationError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
self signed certificate in certificate chain (_ssl.c:1131)'))) - skipping

CodePudding user response:

Credited to pip.pypa.io:

Starting with v1.3, pip provides SSL certificate verification over HTTP, to prevent man-in-the-middle attacks against PyPI downloads. This does not use the system certificate store but instead uses a bundled CA certificate store. The default bundled CA certificate store certificate store may be overridden by using --cert option or by using PIP_CERT, REQUESTS_CA_BUNDLE, or CURL_CA_BUNDLE environment variables.

In regards to the SSL issue, it depends whether you insist on SSL enforcement, if not, you may use an existing flag to ignore this by appending --trusted-host <server_name> ,in the example below: --trusted-host artifactory.

Some suggestions raised to overcome this issue are suggested here as well: pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)"

Do note, prior to using artifactory as a caching/proxy server for Pypi packages, you should configure the pip.conf and .pypirc files according to the SetMeUp instructions: https://www.jfrog.com/confluence/display/JFROG/PyPI Repositories#PyPIRepositories-ResolvingfromArtifactoryUsingpip

For example:

pip.conf:

[global]
index-url = http://artifactory:8081/artifactory/api/pypi/pypi-virtual/simple

.pypirc:

[distutils]
index-servers =
    virtual
    local
    remote
    devpi

[virtual]
repository: http://artifactory:8081/artifactory/api/pypi/pypi-virtual
username: admin
password: ***

[local]
repository: http://artifactory:8081/artifactory/api/pypi/pypi-local
username: admin
password: ***

[remote]
repository: http://artifactory:8081/artifactory/api/pypi/pypi-org-remote
username: admin
password: ***

[devpi]
repository: http://localhost:3141/admin/dev
username: admin
password: ***
  • Related