[Fix] SSL Module Is Not Available In Python

Using SSL in Python, you can encrypt and authenticate network sockets, both client-side and server-side, with Transport Layer Security (often called “Secure Sockets Layer”). The module relies on the OpenSSL library.

As errors are a part of programming.

You may be dealing with installing an SSL module in python. The common error you may face is “SSL module in python is not available. Could not find a version that satisfies the requirement <package> (from versions:) OR No matching distribution was found for <package>’

Why SSL Module Is not available in python?

This module wraps TLS/SSL into a socket that can be accessed from the Operation System (OS) (Lib/ssl.py). In cases where the SSL module is unavailable,

It’s likely that you simply don’t have the OpenSSL libraries installed, or they weren’t found by Python when it was being installed.

You can easily fix this error by installing OpenSSL libraries in your Python program.

installing the OpenSSL module in Python

 fixing SSL Module is not available in Python Error

  1. Install the necessary packages for Python and SSL: $ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
  2. Download and unzip “Python-3.6.8.tar.xz” from your home directory.
  3. Open the terminal in that directory and run: $ ./configure
  4. Build and install: $ make && sudo make install
  5. Install packages with: $ pip3 install package_name

Step-by-step Guide with images

Fixation of this issue is quite simple. But you have to make sure to follow it as it is. Let’s move forward with the steps. 

1. First, make sure that you are done with the installation of all important packages to run Python and SSL. 

To do this, run the following command

sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev.  

With this, all the essential packages will get installed. 

install ssl module in python

2. After the completion of that command, you can choose to run your desired package command to see if it can run without the error showing again. 

ssl module in python is not available Linux

If the error appears, then you will have to download ‘Python 3.6.8’

pip is configured with location that require TLS/SSL

3. To download ‘Python 3.6.8’ go to https://www.python.org/ftp/python/.

4. Now, select ‘Python 3.6.8’ from the list available on the website. 

5. Once you have clicked on it, you will be directed to a page containing different versions of Python 3.6.8. Select the version that has a Linux extension. 

In this case, it is Python-3.6.8.tar.xz. Click on it. 

the ssl module in python is not available windows

6. You will be asked if you want to open the file or save it. Go with the ‘save file’ option. 

download python 3.6.8.tar.xz

Your file will start downloading right away. It will be downloaded in a few seconds with a good internet connection. 

once the download complete, unrar the file

7. Now, open the folder containing the downloaded ‘Python-3.6.8.tar.xz’. 

unwrap the tar file

8. Since you can see the Python folder in the ‘Downloads’, it is time to extract it. Right-click on it and select ‘Extract here’. 

Extract the tar file

The extraction process will start immediately and will be completed in no time. 

9. Once the files in Python-3.6.8.tar.xz are extracted, you can open the extracted folder.

 sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

10. By right-clicking in the folder, you will get a list of options. Select ‘Open in Terminal’. 

The terminal tab will appear on the screen. 

11. Now, run. /configure in the terminal. 

. /configure run in terminal

12. When you are done running that command, run the command sudo make && sudo make install afterward. 

sudo make && sudo make install

13. When both of the commands have run successfully, Python 3.6.8 will get installed without any issue. 

You will see a text indicating its successful installation at the bottom. 

python installed success

14. Now, it is time for you to complete the task that was not running before due to the problem ‘SSL module not available in Python’. 

Simply, write the command for it that is pip3 install package_name, and it will start running immediately without any issue. 

pip install ssl

In this instance, we wrote the command to install protonvpn.  

By carefully following the steps we have mentioned above, you will no longer face the issue of ‘SSL module in python is not available. 

Wrap Up 

Summing it up, not knowing how to deal with the problem of SSL unavailability in python can frustrate anyone. Thus, if you are stuck in this situation, you can easily get out of it by doing the easy steps we have written for your convenience. 

We hope that you have benefited from this guide and will face no more issue now. If you have any queries, you can leave a comment and we will answer it for you.