0

PROBLEM

  • Whatever I try to install from terminal with pip I get this error message
  • I may have installed and fully deleted homebrew (macOS 10.12) before but I am not sure how to solve this
  • The Django 3.0 app runs perfectly well

Installs I try to run (all cases same error message)

pip install -r requirements.txt
pip install django-storages
pip install ssl

ERROR MESSAGE

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

Tried Solutions

sogu
  • 2,738
  • 5
  • 31
  • 90
  • 1
    Have you tried [this](https://stackoverflow.com/questions/41328451/ssl-module-in-python-is-not-available-when-installing-package-with-pip3)? Seems like a library issue. Other than that, try re-installing Python – GTBebbo Apr 18 '20 at 20:16
  • 1
    I n't know why my comments were deleted, so I repeat it again: you get an error when importing the `_ssl` module, so either your virtual env (if you use one) or even your python installation is borked You can check that by trying to import `_ssl` outside the virtual env. Thus the question again - how did you install python? How did you create the virtual env? – hoefling Apr 18 '20 at 20:49
  • 1
    Another thing - don't do `pip install ssl`, it is part of the standard library and installing the third-party `ssl` will bring nothing in best case, causing more errors in worst. – hoefling Apr 18 '20 at 20:51
  • I had to delete my question because, I have updated my question with some sensitive info, sorry. @hoefling just post this and I accept your answer https://stackoverflow.com/a/29969862/10270590 – sogu Apr 18 '20 at 21:11

1 Answers1

0

https://stackoverflow.com/a/29969862/10270590

go to your virtualenv directory (but don't run workon):

cd ~/.virtualenv/name_of_broken_venv

Now delete these files:

rm -rf .Python bin/python* lib/python2.7/* include/python2.7

Then to rebuild your venv, run:

virtualenv .
pip install -r requirements.txt
sogu
  • 2,738
  • 5
  • 31
  • 90