1. PyPA
  2. Python Packaging Authority Projects
  3. setuptools
Issue #18 wontfix

Packages that 'use_setuptools' from older distribute cannot install on setuptools 0.7

Jason R. Coombs
created an issue

Julian and Andres have reported on distutils-sig an issue installing certain packages that incorporate distribute_setup and call use_setuptools.

For example, the following script will reproduce the issue when installing pudb:

#! /bin/sh

set -e
set -x

virtualenv --no-setuptools mypy
source mypy/bin/activate
curl -k https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py | python -
curl -k https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python -
pip install pudb==2013.1 

The error reported will look something like this:

$ pip install pudb==2013.1
Downloading/unpacking pudb==2013.1
  Downloading pudb-2013.1.tar.gz (40kB): 40kB downloaded
  Running setup.py egg_info for package pudb
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
    Extracting in /tmp/tmpkaEQAq
    Now working in /tmp/tmpkaEQAq/distribute-0.6.35
    Building a Distribute egg in /home/andreas/mypy/build/pudb
    Traceback (most recent call last):
      File "setup.py", line 45, in <module>
        exec(init_file.read(), d)
      File "<string>", line 8, in <module>
      File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/__init__.py", line 2, in <module>
        from setuptools.extension import Extension, Library
      File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/extension.py", line 5, in <module>
        from setuptools.dist import _get_unpatched
      File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/dist.py", line 6, in <module>
        from setuptools.command.install import install
      File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/command/__init__.py", line 8, in <module>
        from setuptools.command import install_scripts
      File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/command/install_scripts.py", line 3, in <module>
        from pkg_resources import Distribution, PathMetadata, ensure_directory
      File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2825, in <module>
        add_activation_listener(lambda dist: dist.activate())
      File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 710, in subscribe
        callback(dist)
      File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2825, in <lambda>
        add_activation_listener(lambda dist: dist.activate())
      File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2257, in activate
        self.insert_on(path)
      File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2358, in insert_on
        "with distribute. Found one at %s" % str(self.location))
    ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /home/andreas/mypy/lib/python2.7/site-packages/setuptools-0.7.2-py2.7.egg
    /home/andreas/mypy/build/pudb/distribute-0.6.35-py2.7.egg
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/home/andreas/mypy/build/pudb/setup.py", line 5, in <module>
        use_setuptools()
      File "distribute_setup.py", line 152, in use_setuptools
        return _do_download(version, download_base, to_dir, download_delay)
      File "distribute_setup.py", line 132, in _do_download
        _build_egg(egg, tarball, to_dir)
      File "distribute_setup.py", line 123, in _build_egg
        raise IOError('Could not build the egg.')
    IOError: Could not build the egg.
    Complete output from command python setup.py egg_info:
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz

Extracting in /tmp/tmpkaEQAq

Now working in /tmp/tmpkaEQAq/distribute-0.6.35

Building a Distribute egg in /home/andreas/mypy/build/pudb

Traceback (most recent call last):

  File "setup.py", line 45, in <module>

    exec(init_file.read(), d)

  File "<string>", line 8, in <module>

  File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/__init__.py", line 2, in <module>

    from setuptools.extension import Extension, Library

  File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/extension.py", line 5, in <module>

    from setuptools.dist import _get_unpatched

  File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/dist.py", line 6, in <module>

    from setuptools.command.install import install

  File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/command/__init__.py", line 8, in <module>

    from setuptools.command import install_scripts

  File "/tmp/tmpkaEQAq/distribute-0.6.35/setuptools/command/install_scripts.py", line 3, in <module>

    from pkg_resources import Distribution, PathMetadata, ensure_directory

  File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2825, in <module>

    add_activation_listener(lambda dist: dist.activate())

  File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 710, in subscribe

    callback(dist)

  File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2825, in <lambda>

    add_activation_listener(lambda dist: dist.activate())

  File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2257, in activate

    self.insert_on(path)

  File "/tmp/tmpkaEQAq/distribute-0.6.35/pkg_resources.py", line 2358, in insert_on

    "with distribute. Found one at %s" % str(self.location))

ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /home/andreas/mypy/lib/python2.7/site-packages/setuptools-0.7.2-py2.7.egg

/home/andreas/mypy/build/pudb/distribute-0.6.35-py2.7.egg

Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/home/andreas/mypy/build/pudb/setup.py", line 5, in <module>

    use_setuptools()

  File "distribute_setup.py", line 152, in use_setuptools

    return _do_download(version, download_base, to_dir, download_delay)

  File "distribute_setup.py", line 132, in _do_download

    _build_egg(egg, tarball, to_dir)

  File "distribute_setup.py", line 123, in _build_egg

    raise IOError('Could not build the egg.')

IOError: Could not build the egg.

Comments (6)

  1. Jason R. Coombs reporter

    After some consideration on the issue, here's what I think is happening.

    1. Prior to Distribute 0.6.44, distribute_setup.py and use_setuptools would simply disallow use of use_setuptools on setuptools 0.7 (because older versions of distribute did not know what setuptools 0.7 was going to be).
    2. In Distribute 0.6.44 (and fixed in 0.6.45), distribute_setup.py was updated to allow use of Setuptools 0.7, as Setuptools 0.7 is now known to be a suitable replacement for Distribute following the merge.
    3. Some packages, such as pudb, still have distribute_setup.py from an older version of distribute bundled with them.

    I believe the proper fix is for pudb (and similar packages) to update their bundled distribute_setup.py to the version from 0.6.45 or later (as found at http://python-distribute.org/distribute_setup.py). This change by itself will require all installers of pudb to install that version of distribute or later, which may be undesirable, so they should also update the call to use_setuptools to specify the minimum version. For example, pudb formerly required distribute 0.6.35 or greater, so the call in setup.py should be something like use_setuptools(version='0.6.35').

    I don't believe there's any good way for these packages to support a setuptools 0.7 environment without making these changes to the packages themselves. If someone has a better suggestion on a fix that doesn't involve updating the affected packages, please suggest it here.

  2. Jason R. Coombs reporter

    Another option for these package maintainers (and what pudb has since done) is to remove the bootstrapping of distribute/setuptools and simply require that installers have distribute or setuptools present. While more implicit, this approach should also be strongly considered if the user base can sustain it, at least until the flux from the merge has subsided.

  3. livenson

    I think I'm facing the same issue on ubuntu 12.04 lts, with the latest buildout. It's bootstrap script fails with error like this:

    ubuntu@ip-10-238-235-250:~/stoxy$ python bootstrap.py 
    Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-0.7.2.tar.gz
    Extracting in /tmp/tmpinxV_U
    Now working in /tmp/tmpinxV_U/setuptools-0.7.2
    Building a Setuptools egg in /tmp/tmpGXy_og
    /tmp/tmpGXy_og/setuptools-0.7.2-py2.7.egg
    Traceback (most recent call last):
      File "bootstrap.py", line 91, in <module>
        pkg_resources.working_set.add_entry(path)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 451, in add_entry
        self.add(dist, entry, False)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 542, in add
        self._added_new(dist)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 705, in _added_new
        callback(dist)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <lambda>
        add_activation_listener(lambda dist: dist.activate())
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2227, in activate
        self.insert_on(path)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2328, in insert_on
        "with distribute. Found one at %s" % str(self.location))
    ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /tmp/tmpGXy_og/setuptools-0.7.2-py2.7.egg
    

    Is this indeed the same bug or should a new one be filed?

  4. Jason R. Coombs reporter

    livenson Your description omits what package/project you're trying to bootstrap. From your output, it looks like you're trying to bootstrap 'stoxy'.

    I'm not familiar with what bootstrap does, but what it appears to be doing is trying to install setuptools 0.7.2 using the system-installed 'setuptools' which is actually an old version of distribute (0.6.24 if I recall correctly).

    Yes, the issue you're encountering is similar to the one reported in this ticket. There's no need to file it as there's nothing setuptools can do to fix old, broken versions of distribute.

    I would file your issue with bootstrap and see if they have any suggestions. Perhaps the bootstrap project even has tips on how to install on Ubuntu 12.04.

    You may be able to simply work around the problem by installing a late version of setuptools onto that host (by following the setuptools installation instructions).

  5. livenson

    Hi, Jason R. Coombs, sorry, stoxy was a bit extra info :) It's actually a pure clean bootstrap.py from the buildout (https://pypi.python.org/pypi/zc.buildout/2.2.1 , http://downloads.buildout.org/2/bootstrap.py). That's why I think it's really critical - it fails on LTS ubuntu for the initial step of a pretty wide spread packaging system.

    The system has no installed setuptools/distribute, so the issue is somehow generated from the python + buildout alone. bootstrap.py downloads the egg from this site with wget.

  6. Log in to comment