pip: Issue with MEO ISP in Portugal - 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

  • Pip version: 10.0.0
  • Python version: 3.5.2
  • Operating system: Ubuntu 16.04

Description:

I cannot install packages using pip

What I’ve run:

pip install cython pip install kivy pip install --upgrade pip

all this leads to the same error as below.

pip install kivy -v

Outputs:

Created temporary directory: /tmp/pip-ephem-wheel-cache-rs27mmeh
Created temporary directory: /tmp/pip-install-dtnthpzj
Collecting kivy
  1 location(s) to search for versions of kivy:
  * https://pypi.python.org/simple/kivy/
  Getting page https://pypi.python.org/simple/kivy/
  Looking up "https://pypi.python.org/simple/kivy/" in the cache
  Returning cached "301 Moved Permanently" response (ignoring date and etag information)
  Looking up "https://pypi.org/simple/kivy/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): pypi.org
  Incremented Retry for (url='/simple/kivy/'): Retry(total=4, connect=None, read=None, redirect=None, status=None)
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/kivy/
  Starting new HTTPS connection (2): pypi.org
  Incremented Retry for (url='/simple/kivy/'): Retry(total=3, connect=None, read=None, redirect=None, status=None)
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/kivy/
  Starting new HTTPS connection (3): pypi.org
  Incremented Retry for (url='/simple/kivy/'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/kivy/
  Starting new HTTPS connection (4): pypi.org
  Incremented Retry for (url='/simple/kivy/'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/kivy/
  Starting new HTTPS connection (5): pypi.org
  Incremented Retry for (url='/simple/kivy/'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/kivy/
  Starting new HTTPS connection (6): pypi.org
  Could not fetch URL https://pypi.python.org/simple/kivy/: connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/kivy/ (Caused by ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))) - skipping
  Could not find a version that satisfies the requirement kivy (from versions: )
Cleaning up...
No matching distribution found for kivy
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/commands/install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/operations/prepare.py", line 243, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/req/req_install.py", line 307, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/local/lib/python3.5/dist-packages/pip-10.0.0-py3.5.egg/pip/_internal/index.py", line 533, in find_requirement
    'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for kivy
You are using pip version 10.0.0, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 75 (14 by maintainers)

Most upvoted comments

One workaround is to disable IPv6.

  1. Disable IPv6
  2. Run pip
  3. Enable IPv6

@lvale thank you for that information.

There is a known issue with Thomson / Technicolor Gateway routers where they reset the IPv6 flow label in the middle of a TCP session when it is supposed to be static from the SYN to the FIN.

Large networks and service providers, Fastly included, use ECMP for load balancing. Ideally the path selection uses hashing that keeps a single TCP session on the same path.

Although Fastly mostly avoids using IPv6 flow label as an input into hashing:

  • some equipment does not let you exclude it
  • some other networks choose to configure it.

By reseting the IPv6 flow label in the middle of the TCP session the router is likely forcing ECMP rehashing somewhere in the path between yourself and Fastly. This could mean that subsequent packets land on the wrong cache or even in the wrong POP.

You can prove it’s the router by connecting your computer directly to the ONT and retesting.

I don’t have any straightforward solution for you. Your options appear to be:

  • seek out the latest firmware for your device, see if that fixes the problem
  • replace the supplied router with one of your own

Same problem using MEO in Évora (Ubunbu 18.04). Also solved it with: sudo sh -c ‘echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6’

Closing this since this looks like a problem that has been resolved. 😃

For now, my solution is temporarily disabling IPv6 on Linux with sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' , that way it isn’t anything permanent. But I still want this fixed on MEO’s side, so I’ll try to figure this out, since every time the router reboots, it keeps my DNS server settings (either google’s or cloudflare’s), but it creeps their IPv4 and IPv6 DNS back in on set 100. Pip strangely works with IPv6 disabled, which is nothing short of bizarre, but I’ll look onto this further.

Yes, can confirm it’s MEO, we’ve tried a mobile hotspot from NOS and we have been able to reach vagrantup.com rubygems.org python.org pypa.io , all fastly served at tls 1.2

Failure on MEO ISP network in Coimbra Area with the following OS’s:

Network 1 (Business MEO ISP connection) : Ubuntu 18.04 - Machine1 Ubuntu 16.04 - Machine2 Windows 10 Professional - Machine1

Network 2 (Home MEO ISP connection) : Ubuntu 18.04 - Machine1

Success on NOS mobile hotspot: Ubuntu 18.04 - Machine1 Ubuntu 16.04 - Machine2 Windows 10 Professional - Machine1

Haven’t been able to test other ISP’s. However and this is the strange part:

I’ve been able to successfully use pip without failure using Docker NAT on MEO ISP: docker run -it --rm python:alpine sh / # pip install requests Collecting requests Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB) 100% |████████████████████████████████| 92kB 776kB/s Collecting certifi>=2017.4.17 (from requests) Downloading https://files.pythonhosted.org/packages/df/f7/04fee6ac349e915b82171f8e23cee63644d83663b34c539f7a09aed18f9e/certifi-2018.8.24-py2.py3-none-any.whl (147kB) 100% |████████████████████████████████| 153kB 2.5MB/s Collecting idna<2.8,>=2.5 (from requests) Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB) 100% |████████████████████████████████| 61kB 5.4MB/s Collecting urllib3<1.24,>=1.21.1 (from requests) Downloading https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl (133kB) 100% |████████████████████████████████| 143kB 7.0MB/s Collecting chardet<3.1.0,>=3.0.2 (from requests) Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB) 100% |████████████████████████████████| 143kB 6.0MB/s Installing collected packages: certifi, idna, urllib3, chardet, requests Successfully installed certifi-2018.8.24 chardet-3.0.4 idna-2.7 requests-2.19.1 urllib3-1.23 / # However unable to install while connected via wifi or ethernet All dns cache has been flushed, nslookup returns the same IP address on both NOS and MEO network. ilhicas@ilhicas-HP-Notebook:~$ pip install virtualenv Collecting virtualenv Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, 'Connection reset by peer'))': /simple/virtualenv/ Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, 'Connection reset by peer'))': /simple/virtualenv/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, 'Connection reset by peer'))': /simple/virtualenv/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, 'Connection reset by peer'))': /simple/virtualenv/

Update: Running the pip install <package> command via Powershell does not give this error.

I think Fastly has fixed the issue on their side.

I have the broken router and I see no issue doing curl -6 https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl -o /dev/null

PS: Linux users, with the broken router can also disable IPv6 Flow Labels instead of disabling IPv6 by changing this sysctl -w net.ipv6.auto_flowlabels=0. This is temporary change, check your distro docs on how to do a permanent change.

Hi folks!

If you’re still having issues connection to PyPI w/ MEO as your ISP, please open an issue in pypa/pypi-support using the ‘Network Access Issue’ template.

That is a much better place for further discussion on this issue + better visibility for PyPI admins, so that they may take a look if there’s anything actionable on the PSF-infra side.

I report that sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' worked for me as well! Thanks a lot!! I wasnt able to install anything with pip

With a little more searching found a tentative solution here https://www.reddit.com/r/portugal/comments/8cjj3s/developers_com_meo_em_casa_conexões_bloqueadas/

which is basically to disable ipv6 on the router/gateway

telnet to router/gateway

telnet _ipaddress_
dhcp serverv6 config state=disabled
ip ifconfig intf=LocalNetwork ipv6=disabled
saveall
exit

Not sure it will last the “periodic” updates by the ISP…

For those experiencing this v6 issue it would be very helpful if you could provide a packet capture of it failing. Please send them to support@fastly.com and mention this issue and our ticket ECO-2664

Hello!! I’ve found a solution! I’ve change not only the IPv4 DNS but also the IPv6 to another provider then the ISP one, and now it works! Cheers!

I’ve had this error only in Coimbra, been to Évora this past weekend without issues reaching the sites mentioned before under a Windows OS, I hadn’t tried via Ubuntu (given other issues)

Regarding the contacting MEO, I haven’t done it also due to the same reasons, If you have a technical issue with their hardware it’s already a pain to get it fixed, so I can only imagine the terrors you would go through explaining this… 😄

The only NOT a real solution for now is to switch to their MEO-WIFI infra when you need it. And besides that, you can always use docker, as from what it seems under a docker container I have no issues… That alone tilts me… Can’t figure out why yet. So you could create a volume from the container to the host to the place you wish to do the pip install, maybe some virtual environment creation with all the packages you wish to install via pip. When I get the time I’ll post here that solution

Yet another strange report.

When connected to MEO-WIFI ( using the same router ) i’m able to reach all above mentioned domains correctly as well as pip install.

I’ve also edited nameservers to google without any luck, flushing cache dns etc…on the private network.

Yep. MEO here.

eheheh. Is it MEO? Because I just upgraded my internet and got a new MEO router (they promised the FiberGateWay, but I got a crappy one. Still trying to solve that one out) and I started having this error on my RPi.