setuptools: Bootstrap script unable to locate releases following 20.10.0 release

How to test:

Download

https://bootstrap.pypa.io/bootstrap-buildout.py

At the time of this ticket, __version__ of this file is 2015-07-01.

Run

python bootstrap-buildout.py

You get

Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-20.10.1.zip
Extracting in /tmp/tmpIKldPD
Traceback (most recent call last):
  File "bootstrap-buildout.py", line 117, in <module>
    ez['use_setuptools'](**setup_args)
  File "<string>", line 173, in use_setuptools
  File "<string>", line 124, in _do_download
  File "<string>", line 64, in _build_egg
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "<string>", line 103, in archive_context
  File "/usr/lib/python2.7/zipfile.py", line 714, in __init__
    self._GetContents()
  File "/usr/lib/python2.7/zipfile.py", line 748, in _GetContents
    self._RealGetContents()
  File "/usr/lib/python2.7/zipfile.py", line 763, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

You get the same error with 20.10.0.

python bootstrap-buildout.py --setuptools-version=20.10.0

Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-20.10.0.zip
Extracting in /tmp/tmp6G6ZVT
Traceback (most recent call last):
  File "bootstrap-buildout.py", line 117, in <module>
    ez['use_setuptools'](**setup_args)
  File "<string>", line 173, in use_setuptools
  File "<string>", line 124, in _do_download
  File "<string>", line 64, in _build_egg
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "<string>", line 103, in archive_context
  File "/usr/lib/python2.7/zipfile.py", line 714, in __init__
    self._GetContents()
  File "/usr/lib/python2.7/zipfile.py", line 748, in _GetContents
    self._RealGetContents()
  File "/usr/lib/python2.7/zipfile.py", line 763, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

20.9.0 works fine, so this bug was introduced in 20.10.x.

python bootstrap-buildout.py --setuptools-version=20.9.0

Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-20.9.0.zip
Extracting in /tmp/tmpXrDIjV
Now working in /tmp/tmpXrDIjV/setuptools-20.9.0
Building a Setuptools egg in /tmp/bootstrap-OVHpkN
warning: no files found matching '*' under directory 'setuptools/_vendor'
warning: no files found matching '*.txt'
/tmp/bootstrap-OVHpkN/setuptools-20.9.0-py2.7.egg

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 42 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Seems that the problem is: https://bitbucket.org/pypa/pypi/issues/438/backwards-compatible-un-hashed-package and ez_setup has the old pypi URL format hard-coded… (He use https://pypi.python.org/pypi/setuptools/json to get last version but not right URLs 😦 )

Folks, my PR fixes this.

It used pypi.io and it adds the --location option to curl.

I just hit the same “File is not a zip file” error by simply downloading ez_setup.py from the official recommended source and running it

@FrancescoRizzi, I think the issue might be that you have a bad download locally. If ez_setup.py finds a local copy, it doesn’t attempt to download it again. If you remove the local (probably small) zip file and re-run the script, I expect it will work. I’ve tested the latest bootstrap script on OS X and Ubuntu (with and without curl) and the download executes normally as expected.