Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
98 views
in Technique[技术] by (71.8m points)

python - 'pip install' fails for every package

First, sorry to raise such common issue, as I saw there are plenty of posts with similar issue, but yet I didn't find solution.

Every package I'm trying to install I'm getting the same error.

For example: pip install flask (tried also pip3 instead)

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/flask/
ERROR: Could not find a version that satisfies the requirement flask (from versions: none)
ERROR: No matching distribution found for flask

I was using python 3.7.X and was able to install packages before (~year ago), but today start getting those errors. I tried uninstall python and install the latest version:

Python 3.9.1

pip 20.2.3

(window 8.1)

I checked the connection by running "$ curl https://pypi.org" and doesn't see any error. Tried to set timeout of 60 seconds but same error.

What else I can check?

question from:https://stackoverflow.com/questions/65854115/pip-install-fails-for-every-package

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In case someone has similar issue - I got answer in git issue https://github.com/pypa/pip/issues/9508

"it seem to be something with IPv6."

Solution: open the HOSTS file, which is located at C:WindowsSystem32Driversetc, in notepad running as Administrator. Than just add 2 lines at the end:

151.101.0.223 pypi.org 151.101.1.63 files.pythonhosted.org


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...