Pip: i cannot install or upgrade pip "ssl error"

Created on 29 May 2018  路  17Comments  路  Source: pypa/pip

* Pip version:9.0.3

auto-locked

Most helpful comment

try :

pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org

All 17 comments

try :

pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org

Hi @saisk73!

It seems like you're having issues communicating with PyPI. I think you might be able to circumvent these SSL issues if you pass --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org to pip when using it.

That said, that can open you up to potential security issues.

Hi
New python 3.6.5 install on win10, You need to upgrade to pip 10.0.1 manually for trusted-host to work

PS C:\Users\morten.sensio> pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pip/
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)) - skipping

PS C:\Users\morten.sensio> pip --version
pip 9.0.3 from c:\users\morten.sensio\appdata\local\programs\python\python36-32\lib\site-packages (python 3.6)
PS C:\Users\morten.sensio> python --version
Python 3.6.5
PS C:\tmp> curl "https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd04ab4/pip-10.0.1-py2.py3-none-any.whl" -o pip-10.0.1-py2.py3-none-any.whl
PS C:\tmp> python -m pip install --no-index pip-10.0.1-py2.py3-none-any.whl
PS C:\tmp> pip --version
pip 10.0.1 from c:\users\morten.sensio\appdata\local\programs\python\python36-32\lib\site-packages\pip (python 3.6)



md5-596755e3bd33066f709fad065a1f9b5f



PS C:\tmp> pip install flask
Collecting flask
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/flask/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/flask/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/flask/
:<skipped>



md5-70ee9b970c6b30bbb0505df6a68258d8



PS C:\tmp> pip install flask --trusted-host pypi.org --trusted-host files.pythonhosted.org
Collecting flask
  Downloading https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl (91kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 92kB 23.0MB/s
:<skipped>



md5-c52a4f324b3ccc8c53e4c785b79a1a02



$ openssl s_client -showcerts -servername files.pythonhosted.org -connect files.pythonhosted.org:443 2>/dev/null | openssl x509 -text | grep 'Not Before:'
            Not Before: Jun  1 18:50:10 2018 GMT
^C
$ openssl s_client -showcerts -servername pypi.org -connect pypi.org:443 2>/dev/null | openssl x509 -text | grep 'Not Before:'
            Not Before: Mar 28 00:00:00 2018 GMT
^C

You also need to pass --trusted-host pypi.python.org on older versions.

Closing as a duplicate of #4459.

@fenchu you saved the day man.. thank you very much for elaborated explanation

@fenchu thanks

screenshot 73
i am getting this error plz give the solution

@ajsjagadesh i'm getting the same thing idk

I am getting the same issue, and all replies here seems to assume this error only happens if you already have some PIP version installed.
What do I do if I don't have PIP installed at all?

Learning_Python_Requests\Scripts>pip install requests
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

(Learning_Python_Requests) C:\Users\erikl\OneDrive\Desktop\Python_Scripts\Learning_Python_Requests\Scripts>pip --version
pip 10.0.1 from c:\users\erikl\onedrive\desktop\python_scripts\learning_python_requests\lib\site-packages\pip (python 3.7)

(Learning_Python_Requests) C:\Users\erikl\OneDrive\Desktop\Python_Scripts\Learning_Python_Requests\Scripts>pip install requests --trusted-host pypi.org --trusted-host files.pythonhosted.org
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

I'm still getting the same issue. Not sure this is resolved. The only difference is that I'm trying to install the requests library and not flask.

I am getting the same issue, and all replies here seems to assume this error only happens if you already have some PIP version installed.
What do I do if I don't have PIP installed at all?

You have to install pip before you can install any libraries. If you don't have pip you may not have installed python yet, or at least not correctly.
Have you tried checking your python version?
Do the following code in your command line to check. You should get a response with your version:
$ python3 --version
Here's a link with more info.
https://ehmatthes.github.io/pcc/chapter_01/osx_setup.html

I came across this error while operating in a chroot environment. I solved it by running on the host system:

mount --rbind /run /chroot/run
mount --rbind /dev /chroot/dev
mount --rbind /proc /chroot/proc
mount --rbind /sys /chroot/sys

https://python-forum.io/Thread-Cannot-update-or-install-anything-with-pip-SSL-error
python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip

this worked on windows
https://python-forum.io/Thread-Cannot-update-or-install-anything-with-pip-SSL-error
python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings