Had some issues with my recent install of Python 2.7.15 on my new work laptop. Attempting to install any python packages with pip would fail like this:
1 2 3 4 5 6 7 8 9 10 11 12 |
PS C:\Users\user\Documents\Visual Studio Code\Python Scripts> pip install urllib3 --upgrade Collecting urllib3 Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /simple/urllib3/ Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /simple/urllib3/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /simple/urllib3/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /simple/urllib3/ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /simple/urllib3/ Could not fetch URL https://pypi.org/simple/urllib3/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/urllib3/ (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)) - skipping Could not find a version that satisfies the requirement urllib3 (from versions: ) No matching distribution found for urllib3 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(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)) - skipping PS C:\Users\user\Documents\Visual Studio Code\Python Scripts> pip install urllib3 --upgrade |
I found the solution to get it up and running again here:
- Import of ‘urllib3.util’ failing in Python 2.7?
- pip install fail with SSL certificate verify failed (_ssl.c:833)
- https://pip.pypa.io/en/stable/user_guide/#configuration
Creating C:\ProgramData\pip\ and pip.conf inside there, I added the two trusted-host entries:
1 2 |
[global] trusted-host = pypi.org files.pythonhosted.org |