Issue
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?
Solution
If it can help anyone, I found a solution: before doing
sudo ./configure --enable-optimizations
sudo make altinstall
I simply modified part of the file Modules/Setup.dist
from
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
# _ssl _ssl.c \
# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
# -L$(SSL)/lib -lssl -lcrypto
to
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/etc/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
Notice that /etc/ssl is the actual location where I have ssl installed.
After the file modification I than installed with
sudo ./configure --enable-optimizations
sudo make altinstall
And now (after eventually upgrading pip and setuptools) pip works fine.
Answered By - user17788510 Answer Checked By - Gilberto Lyons (WPSolving Admin)