SSL module is not available

If you are trying to use pip and get an error

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

So you don't have any libraries installed to work with ssl.

Try installing them and then reinstall Python with configure make install

In Ubuntu , Debian and other .deb Linux distros you can use the following command

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

In CentOS , RedHat Rocky and other .rpm based distors use

sudo yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel zlib* libffi-devel readline-devel tk-devel

Then download Python with wget the following command will work for most Linux distros

wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz ; tar xvzf Python-3.9.1.tgz ; cd Python-3.9.1 ; ./configure ; sudo make install

If it works fine you can start using pip.

If it did not - try uninstalling old Python first, and install new one after.

Detailed instruction on isntalling Python in Linux can be found here

↓ Python articles ↓
Development in Python
Interactive mode
Virtual environment
str: strings
\: line break
Lists
Loops
Methods
Functions
*args **kwargs
enum
Determine a Python variable type
Testing with Python
Working with REST API in Python
Files: write, read, append, context manager…
Download a file over the network
SQLite3: working with a database
datetime: Date and Time in Python
Selenium + Python
Difficulties when working with Python
DJANGO
Flask
Script for a ZPL printer
socket :Python Sockets
subprocess: run bash commands from Python
multiprocessing: several processes at once
psutil: system resources
sys.argv: command line arguments
PyCharm: IDE
pydantic: data validation
paramiko: SSH from Python
enumerate
json.dumps

Article author: Andrei Olegovich