0

This question has been answered here but for Windows users. I am getting this error on a Linux machine on a 3rd party application under a Anaconda environment. I added the following paths to my PATH env:

<path>/anaconda2/lib
<path>/anaconda2/bin

But when I run:

import requests
requests.get("https://api.ipify.org")

I get the error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='api.ipify.org', 
port=443): Max retries exceeded with url: / (Caused by SSLError("Can't 
connect to HTTPS URL because the SSL module is not available."))

The 3rd party application and a conda shell both include those paths in the PATH env but it only works on the shell.

  • Does this answer your question? [Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") Error in PyCharm requesting website](https://stackoverflow.com/questions/54135206/requests-caused-by-sslerrorcant-connect-to-https-url-because-the-ssl-module) – AMC Jun 09 '20 at 04:36
  • That is the question I linked, but it is for windows users. It was a problem with the 3rd party app libraries. – Mohammed Hamid Jun 11 '20 at 08:06

2 Answers2

0

The error message says "SSL module is not available". Requests uses openssl for its "SSL module" so make sure openssl is installed and working correctly.

First run:

~$ conda list

You should see openssl and pyopenssl in the output

if you don't install openssl and pyopenssl

If openssl is installed run:

~$ openssl

If you get:

openssl: error while loading shared libraries: libcrypto.so.1.0.0: cannot enable executable stack as shared object requires: Invalid argument

Run using the version number from above

~$ sudo find / -name libcrypto.so.[your version] 

Then using the path to libcrypto.so.[your version] from the output of the above:

~$ sudo execstack -c [path to]/libcrypto.so.[your version]

Then run to test:

~$ openssl
OpenSSL>

You will need to do this for all environments

Dan-Dev
  • 7,171
  • 3
  • 31
  • 45
0

It turns out the _ssl.so module in the lib-dynload directory of my python environment was being overriden by the _ssl.so module in the 3rd party software, it was conflicting. So I have made a sym-link to my own module.