0

I am trying to do pip install to install tensorflow in my computer. I am behind company proxy and I am bypassing SSL cert so normally I would use this command

pip --proxy 0.0.0.0:80 --trusted-host pypi.python.org install tensorflow

It normally works well but just today pip install keeps throwing SSL certificate error to me:

Collecting tensorflow
  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:749)'),)': /simple/tensorflow/
  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:749)'),)': /simple/tensorflow/
  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:749)'),)': /simple/tensorflow/
  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:749)'),)': /simple/tensorflow/
  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:749)'),)': /simple/tensorflow/
  Could not fetch URL https://pypi.python.org/simple/tensorflow/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/tensorflow/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)) - skipping
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

I tried to use curl and it works:

curl -x 0.0.0.0:80 -k -L https://pypi.python.org

How is it that curl works but pip does not? And how to make it work using pip?

My environment:

Windows 10
pip 9.0.3
curl 7.54.1
addicted
  • 2,901
  • 3
  • 28
  • 49
  • Possible duplicate of [Not able to install python packages \[SSL: TLSV1\_ALERT\_PROTOCOL\_VERSION\]](https://stackoverflow.com/questions/49768770/not-able-to-install-python-packages-ssl-tlsv1-alert-protocol-version) – phd Apr 19 '18 at 14:51
  • I tried that method but it does not work. It manages to download the `get-pip.py` script but when trying to run the script, it bumps into another https issue again. I manually upgraded into pip 10 by doing offline installation `pip install --no-index --find-links=/path/to/localpip pip`. It manages to uninstall older pip and upgrade to new pip but same SSL problem persists. – addicted Apr 19 '18 at 17:22

1 Answers1

0

To make pip work for the install, you need to install pip using curl:

curl https://bootstrap.pypa.io/get-pip.py | python

The reason is that Python.org sites have stopped supporting older versions of TLS, so you need a later version of pip now. See this answer for more details.

Anupam
  • 14,950
  • 19
  • 67
  • 94