I’m on Ubuntu 22.04.1 which comes whit its own python3.11, where pip works perfectly.
If I install other python versions through apt-get (sudo apt-get install python3.10
) the related pip works perfectly.
But I just installed an alternative python version (3.7.9 ) from source (I’m not able to use apt for this python version), doing the following
cd usr/lib
sudo wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
sudo tar xzf Python-3.7.9.tg
cd Python-3.7.9
sudo ./configure --enable-optimizations
sudo make altinstall
Python3.7 works fine, but if I try to install any package (using pip3.7 or, after creating a virtualenv based on python3.7, using pip) I get the following warning
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Followed by the error
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
I’m sure I have Openssl installed because other versions of python don’t give probelms with pip (also I can see ssl in the folder /etc/ssl
) so the problem seems to be related only on a link between ssl and python installed from source.
Any suggestions?
2
Answers
If it can help anyone, I found a solution: before doing
I simply modified part of the file Modules/Setup.dist
from
to
Notice that /etc/ssl is the actual location where I have ssl installed.
After the file modification I than installed with
And now (after eventually upgrading pip and setuptools) pip works fine.
For Python 3.11.1 on Ubuntu 22.04.1, you do not need to modify any distribution files, just add
--with-openssl-rpath=/usr/lib/x86_64-linux-gnu
to the ./configure command line.The ssl & crypto libs are in that directory, and this ensures they’re located at runtime
Note this assumes you’re running on an x86_64 distro, I expect there’s a similar directory on ARM.