1

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?

Shahriar.M
  • 818
  • 1
  • 11
  • 24

2 Answers2

2

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.

My Work
  • 2,143
  • 2
  • 19
  • 47
1

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
Lior Cohen
  • 5,570
  • 2
  • 14
  • 30
  • Unfortunately, I get the same error! Do you think it may be due to bad installation of python? I'm using python3.7.9 – Shahriar.M Nov 12 '20 at 15:59
  • try this: --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org – Lior Cohen Nov 12 '20 at 16:16