2

I have python installed through the awscli virtualenv on macOS. When I tried to launch awscli I get SSL error:

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 get the same error when I try to reinstall python or awscli in virtualenv. These are the current Python and pip versions:

~$ which python
/Users/roksolana/.virtualenvs/awscli/bin/python

~$ python --version
Python 3.7.4

~$ which pip
/Users/roksolana/.virtualenvs/awscli/bin/pip

~$ pip --version
pip 19.2.1 from /Users/roksolana/.virtualenvs/awscli/lib/python3.7/site-packages/pip (python 3.7)

OpenSSL is installed on my macOS. How can I resolve this issue?

Cassie
  • 2,941
  • 8
  • 44
  • 92
  • Did you build python from source or did you brew it ? – Anshuman Tiwari Feb 05 '20 at 10:15
  • I have installed it from source – Cassie Feb 05 '20 at 10:31
  • It seems that your python installation was incomplete. You will have to rebuild(make and make install) after installing the dependencies. Try installing dependencies such as (brew install) libffi, libssl, zlib1g, libncurses5, libncursesw5, libreadline, libsqlite3. Make sure to enable optimizations while configuring(./configure --enable-optimizations) the source. If you want to save some time, just brew it. – Anshuman Tiwari Feb 05 '20 at 11:07
  • It is weird as I did not have any issues since Python installation (6 months ago). I don't understand what could change and cause this error – Cassie Feb 05 '20 at 13:43

1 Answers1

0

Try installing pip without pip. This issue has been reported here and also here.

Install curl (if you don't have that on your system) and run:

curl https://bootstrap.pypa.io/get-pip.py | python
Redowan Delowar
  • 1,580
  • 1
  • 14
  • 36
  • 1
    When I try to run curl I get the same error message and this warning: `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/` So I can't even re-install it – Cassie Feb 10 '20 at 09:23
  • Does this work for you? `pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org` If it does then your `ssl certificates` got updated. – Redowan Delowar Feb 10 '20 at 09:45