[Distutils] Why is requiring version 0.0.1 when both 0.0.1 and 0.0.2 are available a conflict?

ryles rylesny at gmail.com
Mon Aug 17 09:23:50 CEST 2009

I have 2 egg versions of 'mypkg' installed in /custom/site-packages,
0.0.1 and 0.0.2 This directory is an alternate site directory as
described here: http://peak.telecommunity.com/DevCenter/EasyInstall#administrator-installation

I have elected to not use easy_install --multi-version since it's
convenient to have easy-install.pth set up so that users can by
default import the latest version if they don't explicitly require a
version either via setup.py or by using pkg_resources.require

However, require() is refusing to resolve version 0.0.1:

Python 2.6.2 (r262:71600, Jul 16 2009, 14:04:28)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
py> from pkg_resources import require
py> require("mypkg==0.0.1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 626, in
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 528, in
pkg_resources.VersionConflict: (mypkg 0.0.2 (/custom/site-packages/
mypkgl-0.0.2-py2.6.egg), Requirement.parse('mypkg==0.0.1'))

Can someone explain what exactly the conflict is (I'm guessing
pkg_resources is unhappy that 0.0.2 is already on sys.path)?

I'd like for users to be able to explicitly use the older version if
they're not yet comfortable with the new one. And a user just writing
a simple script without wanting setuptools, or even simply trying
something in the interactive interpreter, should be able to access the
latest version without needing to know about pkg_resources.

More information about the Distutils-SIG mailing list