pip: error when use pipWARNING: 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/colorama/

  • pip version:19.2.3
  • Python version:3.7.6
  • OS:Windows 10 home

I was trying to install colorama I tried delete and install other versions of python and nothing helped

Output

Collecting colorama
  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/colorama/
  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/colorama/
  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/colorama/
  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/colorama/
  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/colorama/
  ERROR: Could not find a version that satisfies the requirement colorama (from versions: none)
ERROR: No matching distribution found for colorama

in pycharm the same problem with install package

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 34 (1 by maintainers)

Most upvoted comments

First, this is also seem to be the same as #9487, so linking it here.

Second, @liron50 - open the HOSTS file, which is located at C:\Windows\System32\Drivers\etc, 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

Rerun the pip command and everything should work. If anyone trying this workaround, please also check that the DNS resolves to IPv6 address, and if note, write it here.

Note: this method is a workaround only. You should NOT use this method as a constant solution.

Same here, and it also for #9489.

From what I tested, it seem to be something with IPv6. When I ran ping pypi.org I got a lot of timeouts:

ping pypi.org

Pinging pypi.org [2a04:4e42::223] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 2a04:4e42::223:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

But when forcing IPv4, no problem:

ping -4 pypi.org

Pinging pypi.org [151.101.0.223] with 32 bytes of data:
Reply from 151.101.0.223: bytes=32 time=88ms TTL=51
Reply from 151.101.0.223: bytes=32 time=89ms TTL=51
Reply from 151.101.0.223: bytes=32 time=89ms TTL=51
Reply from 151.101.0.223: bytes=32 time=88ms TTL=51

Ping statistics for 151.101.0.223:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 88ms, Maximum = 89ms, Average = 88ms

So I added 151.101.0.223 pypi.org to the HOSTS file and tested again:

py -3 -m pip install -U pip
Requirement already satisfied: pip in c:\python38\lib\site-packages (21.0)
Collecting pip
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/de/47/58b9f3e6f611dfd17fb8bd9ed3e6f93b7ee662fb85bdfee3565e8979ddf7
/pip-21.0-py3-none-any.whl
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/de/47/58b9f3e6f611dfd17fb8bd9ed3e6f93b7ee662fb85bdfee3565e8979ddf7
/pip-21.0-py3-none-any.whl
ERROR: Operation cancelled by user

Now seem as the issue is with the file server (files.pythonhosted.org) so I added it too (151.101.1.63 files.pythonhosted.org) and now everything works:

py -3 -m pip install -U pip
Requirement already satisfied: pip in c:\python38\lib\site-packages (21.0)
Collecting pip
  Downloading pip-21.0-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 1.1 MB/s
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB ...

BTW, I’m with python 3.8.5 on Windows 10 Pro and pip version 21.0.

on Windows 10 just uncheck TCP/IPv6 103758

Control panel -> Network and sharing Center -> Change adapter settings -> right click on your current connection (WiFi or LAN) and choose “Properties” -> Uncheck the box with TCP/IPv6

how do i get there in the settings

Worked for me!! Thanks!

on Windows 10 just uncheck TCP/IPv6

image

DjLegolas , Can you share the instructions for fixing it? how do I add 151.101.0.223 pypi.org to the HOSTS file/files.pythonhosted.org? where can I fine the relevant files?

thanks