question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting "ReadError: not a gzip file" when trying to pip install TileStache on some machines

See original GitHub issue

I hope you help me shed some light on this problem!

I found that when I run pip install TileStache on an ubuntu machine, it is failing with the error:

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", line 1676, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", line 1727, in gzopen
    raise ReadError("not a gzip file")
ReadError: not a gzip file

I noticed that when I wget http://tilestache.org/download/TileStache-1.46.7.tar.gz, I end up with the file as tar file (1.0MB), rather than a gzipped tar file (200KB). However when I download in the browser it is the gzipped tar file.

I think it might be something to do with the server response headers? As a comparison, I uploaded the gzipped tar file to CloudApp and ran pip install http://cl.ly/1O3I322n0S3m/TileStache-1.46.7.tar.gz, which works!

Any help much appreciated. Thanks!

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
sleibmancommented, Jan 10, 2014

You closed this issue many months ago, so probably don’t care, but since your page comes up at the top of a google search for “pip not a gzip file”, I will add the following comment for posterity:

I encountered this same symptom with a new version of the pip client (1.5) working against a very old pypi server. The problem was that the pip code would gunzip while downloading the .tar.gz file, but leave the file extension as .tar.gz, and then when it tried to unpack the file, it would assume (based on the file extension) that it needed to gunzip again.

Note that wget works fine, consistent with your symptoms.

Possible fixes:

  1. This could probably be fixed by updating my pypi server (with the hopes that a newer one would happen to supply a different MIME content-type encoding… based on the pip client code, application/x-gzip would work, but my pypi server supplies a content type of application/x-tar).
  2. Restricting myself to pip 1.4 or earlier is an effective workaround.
  3. Hacking up pip 1.5 as follows (is not a good approach, but…) also makes it work:
# diff /usr/local/lib/python2.7/dist-packages/pip/util.py.orig /usr/local/lib/python2.7/dist-packages/pip/util.py
542c542,548
<     tar = tarfile.open(filename, mode)
---
>     try:
>         tar = tarfile.open(filename, mode)
>     except:
>         # JUST UNTAR THE STINKING THING
>         mode = 'r'
>         tar = tarfile.open(filename, mode)
> 
0reactions
rburhumcommented, Jan 16, 2014

The file will need to be hosted by the official Pypi server at some point anyway since newer versions of pip will only work with self hosted (by default - which can be overridden, but then why do that).

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReadError while installing using pip and tar.gz - Stack Overflow
and it's giving me following error. OSError: Not a gzipped file (b'<!') Some tracebacks and then. tarfile.ReadError ...
Read more >
Not a gzipped file - Part 1 (2019) - fast.ai Course Forums
I am trying my first learning exercise (image classification). I have images in a tar gzipped file on my google drive and have...
Read more >
TileStache - PyPI
TileStache 1.51.14. pip install TileStache. Copy PIP instructions. Latest version. Released: Mar 30, 2019. A stylish alternative for caching your map tiles.
Read more >
Installing a Python module from a gzipped tarball (*.tar.gz) for ...
A quick howto on install python packages that come as gzipped tarballs for OSX or Linux.
Read more >
Untitled
Maquina para sacar tientos, Tilecache vs tilestache, Ruta meilutyte and tom daley ... Entecavir 1 mg, Jesse pattison todrick, Not identified in config...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found