Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i cannot install or upgrade pip "ssl error" #5448

Closed
saisk73 opened this issue May 29, 2018 · 17 comments
Closed

i cannot install or upgrade pip "ssl error" #5448

saisk73 opened this issue May 29, 2018 · 17 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@saisk73
Copy link

saisk73 commented May 29, 2018

* Pip version:9.0.3

  • Python version:3.6.5 latest
  • Operating system:windows 10 home
    screenshot 28
@pradyunsg pradyunsg added the S: needs triage Issues/PRs that need to be triaged label May 31, 2018
@liangdongyang
Copy link

liangdongyang commented Jun 4, 2018

try :

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

@pradyunsg
Copy link
Member

pradyunsg commented Jun 4, 2018

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.

@fenchu
Copy link

fenchu commented Jun 6, 2018

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)

But still cert fails:

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>

But now it works with --trusted-host:

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>

I believe this is because somone have upgraded the ssl certs recently:

$ 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

@pradyunsg
Copy link
Member

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

@pradyunsg
Copy link
Member

Closing as a duplicate of #4459.

@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Jul 15, 2018
@jdhruwa
Copy link

jdhruwa commented Sep 27, 2018

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

@cuevasDev
Copy link

@fenchu thanks

@ajsjagadesh
Copy link

screenshot 73
i am getting this error plz give the solution

@ghost
Copy link

ghost commented Mar 14, 2019

@ajsjagadesh i'm getting the same thing idk

@Mahnas92
Copy link

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?

@eriklarson33
Copy link

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

@eriklarson33
Copy link

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.

@eriklarson33
Copy link

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

@cdauth
Copy link

cdauth commented Apr 19, 2019

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

@sathiql
Copy link

sathiql commented Apr 26, 2019

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

@sathiql
Copy link

sathiql commented Apr 26, 2019

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

@lock
Copy link

lock bot commented May 28, 2019

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.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests