1. Tarek Ziadé
  2. distribute
Issue #323 closed

VersionConflict on setup_requires requirements

Erik Bray
created an issue

A long-standing annoyance with setuptools and distribute, is that if a package has some requirement in setup_requires, but the user already has an old version of that distribution in their site-packages, then the installation will fail with a VersionConflict.

This behavior is antithetical to the use-case for setup_requires, where all build-time requirements are made available to setup.py, installing them into the current directory as eggs, if necessary, but otherwise isolated from disturbing anything in site-packages or affecting run-time behavior.

If a package required by setup_requires is more recent than the installed version, we should still be able to download the more resent version, install it locally as an egg, and activate it on the path in preference to the incompatible installed version.

This mostly just requires a slight addition to WorkingSet.resolve() specifically for this use case.

Comments (10)

  1. Jason R. Coombs

    Arfrever: that's interesting. The tests were passing for me on Travis, which tests against Python 2.5-2.7 and 3.2. I see now that the tests were green but not passing. That's a problem with the test runner. Thanks for pointing that out.

  2. Erik Bray reporter

    Okay, the regression reported in #335 is caused by the fact that distribute_setup.py imports pkg_resources in several places in the use_setuptools() function. In some code paths it then does del sys.modules['pkg_resources'] when it's done with it, but not in other code paths. This results in using a mix of pkg_resources from the old setuptools, and the setuptools package from the new distribute egg, hence the API incompatibility. I would consider this a bug in distribute_setup.py more than anything else--once the distribute setup is done it should switch over to using the new version of pkg_resources among other things.

    A new issue should be opened for the distribute_setup.py bug. Once that's fixed, the fix for this issue can be restored.

  3. Log in to comment