AndreasAhrens.se


Views, guides, tech stuff, Cryptocurrencies and ICOs from the mind of Andreas Ahrens

Tags


AndreasAhrens.se

Home Assistant - zlib.error: Error -3 while decompressing data: invalid distance too far back

2nd August 2017

When I got back from vacation, I was unable to start my Home Assistant instance. Upgrading didn't work either. Finally I got it to upgrade, but some packages would just not install. One of the errors I got:

2017-08-02 17:51:19 ERROR (Thread-4) [homeassistant.util.package] Unable to install package tellcore-py==1.1.2: Exception:  
Traceback (most recent call last):  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/commands/install.py", line 324, in run requirement_set.prepare_files(finder)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/req/req_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies))  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/req/req_set.py", line 620, in _prepare_file session=self.session, hashes=hashes)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/download.py", line 821, in unpack_url hashes=hashes  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/download.py", line 659, in unpack_http_url hashes)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/download.py", line 853, in _download_http_url stream=True,  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 488, in get return self.request('GET', url, **kwargs)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/download.py", line 386, in request  
return super(PipSession, self).request(method, url, *args, **kwargs)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 596, in send r = adapter.send(request, **kwargs)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py", line 37, in send cached_response = self.controller.cached_request(request)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py", line 111, in cached_request resp = self.serializer.loads(request, cache_data)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py", line 114, in loads  
return getattr(self, "_loads_v{0}".format(ver))(request, data)  
File "/srv/homeassistant/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py", line 176, in _loads_v2  
cached = json.loads(zlib.decompress(data).decode("utf8"))  
zlib.error: Error -3 while decompressing data: invalid distance too far back  

This especially was telling:

zlib.error: Error -3 while decompressing data: invalid distance too far back  

The problem was downloaded packages that were corrupt. I use Hassbian so I did the following:

sudo su -s /bin/bash homeassistant  
source /srv/homeassistant/bin/activate  

Then I installed all packages that Home Assistant complained about not being able to install (in /dev-info). Easiest way to find them was to search for == in the dev-info page.

I just ran pip3 install tellcore-py==1.1.2 --no-cache-dir and the the same for all other packages not being able to install. Just add --no-cache-dir to each one.

View Comments