Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from urllib2 to requests breaks pip on certain setups #1421

Closed
nailor opened this issue Jan 3, 2014 · 7 comments
Closed

Switch from urllib2 to requests breaks pip on certain setups #1421

nailor opened this issue Jan 3, 2014 · 7 comments
Labels
auto-locked Outdated issues that have been locked by automation
Milestone

Comments

@nailor
Copy link

nailor commented Jan 3, 2014

Switch introduced by commit ff2854a breaks pip on certain setups.

Sure, this can probably be blamed on those setups too, but it is somewhat bizarre when things all the sudden stop working.

Here's the case:
We run our internal pypi server (with pypi-server fronted by nginx). It serves tar.gz files, but with Content-Type application/x-tar it seems and with Content-Encoding set to 'gzip'.

Looks like when requests encounters this kind of request, it tries to gunzip it, resulting in deflating the actual zipped file.

My guess is that bottle does not handle this correctly in first place, however this breaks pip with pypiserver in version 1.5.

@nailor
Copy link
Author

nailor commented Jan 3, 2014

Looks like pypiserver has fix in place: pypiserver/pypiserver#42

@davidism
Copy link

davidism commented Jan 3, 2014

👍 Ran into the same problem, we have the exact same setup. I know there's a fix in the works for pypiserver, but this seems like something pip might want to be more graceful about as well.

@dstufft
Copy link
Member

dstufft commented Jan 7, 2014

Can you verify that this fixes the problem for you? #1435

@nailor
Copy link
Author

nailor commented Jan 7, 2014

Yup, works for me on with #1435 fix applied

@dstufft
Copy link
Member

dstufft commented Jan 7, 2014

Perfect, thanks.

@dstufft
Copy link
Member

dstufft commented Jan 7, 2014

Closed with #1435

@dstufft dstufft closed this as completed Jan 7, 2014
@davidmarquis
Copy link

For the benefit of posterity (and easier searching for our fellow developers), this fixes the error "not a gzip file" that I experienced with the following stack trace:

Exception:
Traceback (most recent call last):
  File "venv/lib/python2.6/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "venv/lib/python2.6/site-packages/pip/commands/install.py", line 270, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "venv/lib/python2.6/site-packages/pip/req.py", line 1164, in prepare_files
    self.unpack_url(url, location, self.is_download)
  File "venv/lib/python2.6/site-packages/pip/req.py", line 1311, in unpack_url
    retval = unpack_http_url(link, location, self.download_cache, self.download_dir, self.session)
  File "venv/lib/python2.6/site-packages/pip/download.py", line 565, in unpack_http_url
    unpack_file(temp_location, location, content_type, link)
  File "venv/lib/python2.6/site-packages/pip/util.py", line 624, in unpack_file
    untar_file(filename, location)
  File "venv/lib/python2.6/site-packages/pip/util.py", line 542, in untar_file
    tar = tarfile.open(filename, mode)
  File "/usr/lib64/python2.6/tarfile.py", line 1670, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/usr/lib64/python2.6/tarfile.py", line 1721, in gzopen
    raise ReadError("not a gzip file")
ReadError: not a gzip file

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

4 participants