[openstack-dev] [packaging][all] setting minimum version of setuptools in setup.py

Robert Collins robertc at robertcollins.net
Fri Jul 31 06:36:47 UTC 2015

On 30 July 2015 at 05:27, Robert Collins <robertc at robertcollins.net> wrote:
> Similar to pbr, we have a minimum version of setuptools required to
> consistently install things in OpenStack. Right now thats 17.1.
> However, we don't declare a setup_requires version for it.
> I think we should.
> setuptools can't self-upgrade, and we don't have declarative deps yet,
> so one reaction I expect here is 'how will this help'.
> The problem lies in the failure modes. With no dependency declared,
> setuptools will try and *silently fail*, or try and fail with this one
> weird error - that doesn't say anything about 'setuptools 3.3. cannot
> handle PEP 426 version markers'.
> If we set a minimum (but not a maximum) setuptools version as a
> setup_requires, I think we'll signal our actual dependencies to
> redistributors, and folk consuiming python packages, in a much more
> direct fashion. They'll still have to recover manually, but thats ok
> IMO. As long as we don't set upper bounds, we won't deadlock ourselves
> like we did in the past.

These are the errors we get with this when the version present is too-old:
Firstly, 0.6c11 which detects the error and reports it.
Then 3.3 which attempts to upgrade setuptools just-in-time but of
course the old setuptools code is what executes, and so the error is
confusing :/. But still better than no hint at all: the presence of
the setuptools upgrade is a signal.

$ pip install setuptools==0.6c11
Successfully installed setuptools-0.6rc11
$ pip install .
Processing /home/robertc/work/mock
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-wnBxi2-build/setup.py", line 6, in <module>
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/robertc/.virtualenvs/test/local/lib/python2.7/site-packages/setuptools/dist.py",
line 260, in __init__
      File "/home/robertc/.virtualenvs/test/local/lib/python2.7/site-packages/setuptools/dist.py",
line 284, in fetch_build_eggs
        parse_requirements(requires), installer=self.fetch_build_egg
      File "/home/robertc/.virtualenvs/test/local/lib/python2.7/site-packages/pkg_resources.py",
line 569, in resolve
        raise VersionConflict(dist,req) # XXX put more info here
    pkg_resources.VersionConflict: (setuptools 0.6c11

Command "python setup.py egg_info" failed with error code 1 in


$ pip install setuptools==3.3
Collecting setuptools==3.3
  Downloading setuptools-3.3-py2.py3-none-any.whl (545kB)
    100% |████████████████████████████████| 548kB 674kB/s
Installing collected packages: setuptools
  Found existing installation: setuptools 18.0.1
    Uninstalling setuptools-18.0.1:
      Successfully uninstalled setuptools-18.0.1
Successfully installed setuptools-3.3
$ pip install .
Processing /home/robertc/work/mock
    Complete output from command python setup.py egg_info:

    Installed /tmp/pip-Grkk9a-build/setuptools-18.0.1-py2.7.egg
    [pbr] Generating ChangeLog
    error in setup command: Invalid environment marker:
(python_version<"3.3" and python_version>="3")

Command "python setup.py egg_info" failed with error code 1 in

Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud

More information about the OpenStack-dev mailing list