"pip is configured with locations that require TLS/SSL" in debian 8.2

15.5k Views Asked by At

I'm connecting to a virtual server that I rented through ssh.

Its os is Debian 8.2.

I installed python 3.7 and pip.

When I want to install any package with pip I get this error:

pip install django

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/django/ 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/django/ 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/django/ 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/django/ 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/django/ Could not fetch URL https://pypi.org/simple/django/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/django/ (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 django (from versions: none) ERROR: No matching distribution found for django 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

I installed libssl-dev already, and trying pip install ssl won't help and I get the same error.

any ideas?

2

There are 2 best solutions below

2
Lior Cohen On

you can always skip https (on your own risk) by explicitly declaring you trust the pypi.org

pip install --trusted-host pypi.org django

you can also put it on pip.ini file under [global]

[global]
trusted-host = pypi.org
0
Rohit Bhati On

When you got this type of error you just need to re-setup or re-config your python setup using given commands:

  1. sudo apt install build-essential

  2. sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

  3. mkdir ~/python-source-files

  4. wget -P ~/python-source-files https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz

  5. tar xvzf Python-3.7.5.tgz

  6. cd Python-3.7.5

  7. ./configure --with-openssl or ./configure --enable-optimizations

  8. sudo make altinstall

I have fixed same issue using these commands. If you have any query you can ask.