1

In Windows, I have Python 2.7 installed. I am using this version of Python in my virtual environment. When I try pip install with anything I get the following kinds of errors stating that I do not have a valid security certificate.

c:\projects\scrubbed\scrubbed\env\lib\site-packages\pip_vendor\urllib3\util\ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings SNIMissingWarning c:\projects\scrubbed\scrubbed\env\lib\site-packages\pip_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecurePlatformWarning Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/certifi/ c:\projects\scrubbed\scrubbed\env\lib\site-packages\pip_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

I don't have these problems with a Python 3.6.5 virtual environment. Unfortunately, I need to use Python 2.7 for Google App Engine development.

My requirements.txt file includes the following:

Flask>=0.12
Flask-Cors>=3.0.3
flask-restplus>=0.10.1
google-api-python-client>=1.6.5
GoogleAppEngineCloudStorageClient>=1.9.22.1

I am interested in any fixes at this point. I have tried just about everything I have found on StackOverflow.

Edit This is has been identified as a possible duplication of the question, "...Could not find a version that satisfies the requirement...". These error messages were however quite different. My actual fix was to completely install Python 2.7.14, downloaded from Python.org

Blanthor
  • 2,388
  • 8
  • 44
  • 63

1 Answers1

0

See this line in your error:

routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': 

Python.org sites have recently stopped support for TLS v1.0 and v1.1

Try upgrading pip as follows:

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

You can still use Python 2.7 once you upgrade pip since it will then use the later TLS version (i.e >=1.2)

See this answer for more details.

Anupam
  • 12,420
  • 12
  • 51
  • 82