Monthly Archives: May 2022

Python PIP, Can’t connect to HTTPS URL because the SSL module is not available.

If you’re experiencing this error when ‘pip install’-ing or starting up a Docker container, then this post may be of use.

pip install -r requirements-dev.txt
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/jb-bayes/
docker-compose -f docker-compose.yml up -d mysql redis
Traceback (most recent call last):
  File "/home/work/.pyenv/versions/bayes-service/bin/docker-compose", line 5, in <module>
    from .. import tls
  File "/home/work/.pyenv/versions/3.9.2/envs/bayes-service/lib/python3.9/site-packages/docker/", line 2, in <module>
    import ssl
  File "/home/work/.pyenv/versions/3.9.2/lib/python3.9/", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: cannot open shared object file: No such file or directory

This is likely due to libssl being installed, then your python virtualenv env created, then something happening to libssl, such as being upgraded/removed.

The first step to resolve is to ensure you have libssl installed.

Download it from here

Then install:



sudo apt install ./libssl1.0.0_1.0.2n-1ubuntu5.9_amd64.deb 
sudo apt install ./libssl1.0-dev_1.0.2n-1ubuntu5.9_amd64.deb

Once this is done you’ll need to reinstall the Python version you were using when the error originally occurred. In my case I’m using pyenv so had to take the below steps:

pyenv uninstall 3.9.2
pyenv install 3.9.2
pip install -r requirements-dev.txt
# Now installs without issue

If you’re not using pyenv, then however you installed Python remove it and reinstall.