4

We've run into a problem installing Python packages (using pip) for use with QGIS 2.18.x (error messages copied below)

Our diagnosis is that:

  1. Pypi now requires TLSv1.2 support (http using TLSv1.0 and TLSv1.1 are now blocked). See https://pyfound.blogspot.com.au/2017/01/time-to-upgrade-your-python-tls-v12.html
  2. QGIS 2.18.x Python is 2.7.5 and does not support TLSv1.2, and seems it cannot be easily upgraded

Is there a way to enable TLSv1.2 support in the QGIS 2.18.x Python environment, to enable PIP install to work?

PIP install error message from OSGEO4W Shell window (using pint as example: all packages give similar results:)

C:\Windows\System32>python -m pip install pint
Collecting pint
C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\pip\_vendor\requests\pack
ages\urllib3\util\ssl_.py:318: 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/security.html#snimissingwarning.  
SNIMissingWarning
C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: 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/security.html#insecureplatformwarning.
InsecurePlatformWarning
Could not fetch URL https://pypi.python.org/simple/pint/: There was a problem confirming the ssl certificate: [Errno 1] _ssl.c:504: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version - skipping  Could not find a version that satisfies the requirement pint (from versions: )

No matching distribution found for pint
1

Upgrade QGIS to the current Long Term Release. The version of python has now been upgraded to 2.7.14+ which supports TLSv1.2.

1

Downgrade pip version!

Download pip-8.1.2-py2.py3-none-any.whl at https://pypi.python.org/simple/pip/

python -m pip install pip-8.1.2-py2.py3-none-any.whl

PIP Working!!!

  • 1
    Thanks for the suggestion. I downgraded pip as suggested (verified using > python -m pip -V However, > python -m pip install pint fails and gives the same error messages including `Could not fetch URL pypi.python.org/simple/pint: There was a problem confirming the ssl certificate: [Errno 1] _ssl.c:504: error:1407742E:SSL routine s:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version - skipping Could not find a version that satisfies the requirement pint (from versions: ) No matching distribution found for pint' – David Apr 18 '18 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.