Thursday 14 March 2019

PIP no longer works with QGIS 2.18.x Python (TLS version no longer supported)



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

Answer



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



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...