Search code examples
pythonpython-3.xsslpipget-pip.py

ERROR: Could not find a version that satisfies the requirement pip (from versions: none)


I'm facing an installation issue with pip on CentOS while utilizing Python version 3.10.0. I attempted to install pip by executing the get-pip.py script. However, during the process, I encountered errors related to the SSL module, preventing the installation from completing successfully.

To proceed with the installation, I used the following command to retrieve the get-pip.py file:

wget https://bootstrap.pypa.io/pip/get-pip.py

When running the command python get-pip.py, I receive the following error:

[root@env lak]# python get-pip.py
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/pip/
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/pip/
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/pip/
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/pip/
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/pip/
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
ERROR: Could not find a version that satisfies the requirement pip (from versions: none)
ERROR: No matching distribution found for pip
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

How can i fix this issue and install pip on python 3.10.


Solution

  • You're either missing a system SSL library, or the Python installation was built without SSL support.

    You can tell which case it is by running openssl version and python -c "import ssl; print(ssl.OPENSSL_VERSION)".

    If you're just missing an SSL library, the fix can be as simple as yum install openssl.

    If your Python installation doesn't have SSL, then you'll probably have to build Python from source. Make sure you enable the flag ./configure --with-ssl.