0

I tried to install flask in vs code in a virtual environment but I am getting some SSL error. When from my virtual environment, I try to install flask by writing

pip install flask

Then I get this error,

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': /simple/flask/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after 
connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': 
/simple/flask/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after 
connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': 
/simple/flask/
: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after 
connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': 
/simple/flask/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after 
connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': 
/simple/flask/
Could not fetch URL https://pypi.org/simple/flask/: There was a problem confirming the ssl 
certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: 
/simple/flask/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: 
CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate 
chain (_ssl.c:997)'))) - skipping
ERROR: Could not find a version that satisfies the requirement flask (from versions: none)
ERROR: No matching distribution found for flask
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl 
certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max 
retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: 
CERTIFICATE_VERIFY_FAILED] certificate verify failed: self 
signed certificate in certificate chain (_ssl.c:997)'))) - skipping

How to fix this.

Same type of SSL error I got already in my anaconda prompt and anaconda navigator too, when I try to install virtual environment and now I realize that I can't even update any package at all due to this SSL certification error.

The SSL error in anaconda prompt is like,

CondaSSLError: Encountered an SSL error. Most likely a certificate verification issue.

Exception: HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with 
url: /pkgs/main/win-64/current_repodata.json 
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate 
verify failed: self signed certificate in certificate chain (_ssl.c:997)')))

I do need help as it is clearly hampering my learning journey.

  • Are you behind an SSL intercepting proxy? This may be the case at your place of work, school, hospital, etc. When I connect to any of those site I don't see any self-signed certificates in the chain. – President James K. Polk Feb 01 '23 at 15:33
  • Sorry, I don't get exactly what u said. Can u please elaborate? and I am working from my local computer is that related to some issue. – Partha Pratim Sarma Feb 01 '23 at 15:42

1 Answers1

0

This seems to be because the ssl_verify has blocked it. You can try to run the following command and change it to false (This method contains risks):

conda config --set ssl_verify False

Another safe way is let conda know where your SSL certificate locates:

conda config --set ssl_verify <pathToYourFile>.crt

You can read this issue for more details.

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13