I have installed python3.11 on my new devbox, with system debian 9. Everything goes well, but when I using pip to install requirements, error occurs. The details are as follows.
➜ pip3 install virtualenv
Defaulting to user installation because normal site-packages is not writeable
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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/virtualenv/
WARNING: Retrying (Retry(total=3, 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/virtualenv/
WARNING: Retrying (Retry(total=2, 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/virtualenv/
WARNING: Retrying (Retry(total=1, 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/virtualenv/
WARNING: Retrying (Retry(total=0, 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/virtualenv/
Could not fetch URL https://pypi.org/simple/virtualenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/virtualenv/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement virtualenv (from versions: none)
ERROR: No matching distribution found for virtualenv
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
WARNING: There was an error checking the latest version of pip.
I think the key error message is: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
, and
Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")
I have made many efforts:
- reinstall python with openssl according to Question: 57586800
- install other requirements according to Question: 45954528
- set trusted host, like:
pip config set global.trusted-host "pypi.org files.pythonhosted.org pypi.python.org" --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org
Methods above don’t work for me. So I wonder what goes wrong?
More details:
- Before I compile python, I have run:
sudo apt install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.6 libgdm-dev libdb4o-cil-dev libpcap-dev
to install ssl requirements (maybe?)- and then, I run the follow commands to install openssl.
cd /usr/src curl openssl.org/source/openssl-1.0.2o.tar.gz | tar xz cd openssl-1.0.2o ./config shared --prefix=/usr/local/ sudo make sudo make install
- I found the default python2.7 runs well, but python3 doesn’t
➜ ~ python3 -V Python 3.11.3 ➜ ~ python3 -c "import ssl; print(ssl.OPENSSL_VERSION_INFO)" Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python3.11/ssl.py", line 100, in <module> import _ssl # if we can't import it, let the error propagate ^^^^^^^^^^^ ModuleNotFoundError: No module named '_ssl' ➜ ~ python -V Python 2.7.13 ➜ ~ python -c "import ssl; print(ssl.OPENSSL_VERSION_INFO)" (1, 1, 0, 12, 15)
- The openssl version that python3.10+ needs should be greater than 1.1.1(
Note PEP-644 which requires OpenSSL >= 1.1. 1 is released in Python 3.10
)? But the openssl in my Debian9 is1.0.2o
.➜ which openssl /usr/local/bin/openssl ➜ openssl version OpenSSL 1.0.2o 27 Mar 2018
I have upgraded openssl to 3.0 and rebuild python3.10, also doesn’t work.
- Using pyenv to install python also doesn’t. Error, ‘_ssl’ requirement is not satisfied, occurs.
=========================================
Finally, I reinstall the system from debian9 to debian10. The default openssl version is OpenSSL 1.1.1n
. All errors disappear.
The problem is fixed.
5