'SSL module in Python is not available - QGIS

The following error seems to be quite common:

C:\Program Files\QGIS 3.10\apps\Python37>python -m pip install doesnotmatterwhatIputhere
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Most solutions I have seen assume Anaconda is somehow involved or some form of sudo, yum, brew, etc.

I am (this time) using a QGIS interpreter on Windows 10, so none of the above apply.

On the same computer, I have a standard installation of Python in C:\Python37 that works without fail. However, the same error also happened with an OSGeo4W64 install that I tried.

I have put C:\Program Files\QGIS 3.10\apps\Python37 (along with \Scripts and \Lib) in my PATH variable to no avail - which is the closest I can come to simulating the multiplicity of Anaconda "solutions". The same error still results.

I have seen a multiplicity of posts about this problem. Many of them have no answers at all and those that do seem to go the Anaconda route. What about us snake-hating QGIS users?



Solution 1:[1]

Finally I found a solution, installing the openssl for windows, works for all Qgis installations. You can try, if you have openssl installed in your computer, trying to import ssl from your python version of Qgis.

https://slproweb.com/products/Win32OpenSSL.html

enter image description here

Solution 2:[2]

Try install python packages using OSGeo4W Shell (require OSGeo4W install)

Solution 3:[3]

I fixed this by installing the 32 bit version of OSGeo4W.

Solution 4:[4]

The final solution that worked for me was found here: https://bugs.python.org/issue39344

Make sure the libcrypto-1_1-x64.dll and libssl-1_1-x64.dll files are in the same directory as your _ssl.pyd

These files can be found in the C:\Program Files\QGIS 3.x\bin folder and will need to be copied to the C:\Program Files\QGIS 3.x\apps\Python3x\DLLs folder.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Kanarsky
Solution 3 veuncent
Solution 4 CNIDog