4

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?

CNIDog
  • 374
  • 3
  • 18
  • Where did you get your CPython from? It sounds like it was built without SSL/TLS support. On Linux, I've seen vaguely similar things if I compile a CPython without libssl-dev or openssl-devel installed (Debian-based or Redhat-based respectively). – dstromberg Feb 18 '20 at 23:50
  • 1
    QGIS comes packaged with its own Python interpreter. The stand-alone version (that works) was downloaded from https://www.python.org/downloads/ – CNIDog Feb 19 '20 at 15:25

4 Answers4

7

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.

CNIDog
  • 374
  • 3
  • 18
  • This solution worked for me running the OSGeo4W shell as administrator for QGIS 3.26.3. Then I could run `python -m pip...` to install what I needed. In previous versions I could copy the libraries to the `QGIS 3.x`\apps\Python3x\Scripts` folder where `_ssl.pyd` existed, but the newer QGIS has this in `DLLs` folder as shown above. I have sometimes had to remove the libraries for deployed copies such as venv created from the QGIS Python because of runtime incompatibilities. – smalers Oct 17 '22 at 22:43
  • Qgis Version 2.28.13 still has the issue. I recommend to copy all *.dll files. For example sqlite.sql is missing, too. – Stefan Nov 24 '22 at 13:24
5

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

nuipek
  • 61
  • 1
  • 3
  • I guess this is a semi-functional workaround, but it requires including wheels with an installation package. Kind of a pain. QGIS apparently doesn't have much of a forum for reporting significant issues like this one. – CNIDog Feb 26 '20 at 21:17
2

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

Kanarsky
  • 162
  • 1
  • 10
  • worked for me, thanks... Executing OSGeo4W Shell with administrative rights remove 'writable' issue – tayyab Sep 17 '20 at 03:57
1

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

veuncent
  • 1,599
  • 1
  • 20
  • 17