3

I've been struggling with this for quite some time and basically can't do anything with pip. No other posts I've seen seem to apply to my scenario. I appreciate any help anyone can give me.

System is running Centos 7

python was installed through yum running as root.

>python3.6 -m pip --trusted-host=pypi.org --trusted-host=pypi.python.org install flask
Defaulting to user installation because normal site-packages is not writeable
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:877)'),)': /simple/flask/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:877)'),)': /simple/flask/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:877)'),)': /simple/flask/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:877)'),)': /simple/flask/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:877)'),)': /simple/flask/
Could not fetch URL https://pypi.org/simple/flask/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/flask/ (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:877)'),)) - skipping
ERROR: Could not find a version that satisfies the requirement flask
ERROR: No matching distribution found for flask
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(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:877)'),)) - skipping

I have confirmed that pip is at latest:

>python3.6 -m pip --version
pip 21.0.1 from /home/user/.local/lib/python3.6/site-packages/pip (python 3.6)

and openssl is installed in yum

Package 1:openssl-devel-1.0.2k-21.el7_9.x86_64 already installed and latest version

and python can use ssl:

python3.6 -m ssl

Thank you!

EDIT: Older versions of PIP seem to be able to at least download it fine

mr odus
  • 172
  • 1
  • 2
  • 13
  • maybe you can find the answer here https://stackoverflow.com/questions/16370583/pip-issue-installing-almost-any-library – e.arbitrio Mar 02 '21 at 22:21
  • nope... I've gone through every solution in that thread and its for a different problem. – mr odus Mar 03 '21 at 15:19

1 Answers1

0

I just had this exact same error today, and in my case it was because Python couldn't handle the HTTP proxy environment variables that was set on the server. It seems like Python was trying to start a TCP handshake with a HTTP port (:80) and obviously failing.

Fortunately, in my case I was able to reach pypi.org without a proxy, so this solved my problem:

http_proxy= https_proxy= sudo pip3.8 install [PKGNAME]

If this doesn't work for you, double check that you got all the various environment variables:

env | grep -i proxy

For example, they may be written in all caps on your system (HTTP_PROXY/HTTPS_PROXY) or you could have ALL_PROXY/all_proxy set.

If it still doesn't work, you probably can't reach pypi without the proxy, so you'll have to figure out how to make it work.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Hubro
  • 56,214
  • 69
  • 228
  • 381