'libssl not found by Python on Ubuntu 22.04

As the title says, I've just upgraded to Ubuntu 22.04 LTS and my previously working setup now says ImportError: libssl.so.1.1: cannot open shared object file: No such file or directory when starting Jupyter, and equivalently throws Could not fetch URL https://pypi.org/simple/jupyter/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/jupyter/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping whenever trying to use pip.

Libssl is actually available at /usr/lib/x86_64-linux-gnu/libssl.so.1.1. I could change LD_LIBRARY_PATH but this seems to be a workaround.



Solution 1:[1]

I resolved this problem by reinstalling the environment.

I use pipenv and pyenv. I removed the pipenv environment and the Python version using pyenv. Then reinstalled both.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yuri Thomas Pinheiro Nunes