python ssl module is not available

python

Problem 

After installing python3 , I started receiving this error while trying to use pip to install a package/module.

 

I decided to go into python's REPL and import the ssl module and received and ImportError: No module named SSL

 

ssl module python

 

Most articles I read on the internet indicated that my distro did not have ssl installed. I checked the openssl version and it was an olded version installed

OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008


I read on some forum that the python's version(3.6.1) I was using did not support this particular older version of openssl installed on my distro.

 

Solution

 

The solution was to install a newer version of openssl and  rebuild python while pointing to the new installation.

 

Refer to this link to build openssl

Refer to this link to build python and point to the newly built openssl.

 

The version that worked for me was

openssl version

OpenSSL 1.0.2n  7 Dec 2017

Python version 

Python 3.6.1