[Distutils] Disabling --single-version-externally-managed

Phillip J. Eby pje at telecommunity.com
Sat Sep 1 01:33:22 CEST 2007

At 03:26 PM 8/31/2007 -0700, Toshio Kuratomi wrote:
>I'm using sqlalchemy0.3 and sqlalchemy0.4 as my test case.  Install
>sqlalchemy0.3 using::
>   easy_install --prefix=$RPM_BUILD_ROOT/usr -m dist/SQLAlchemy-0.3*.egg
>Then install sqlalchemy0.4 using::
>   python setup.py install --root=$RPM_BUILD_ROOT%{python_sitelib}
>This creates the following in site_packages::
>   SQLAlchemy-0.3.10-py2.5.egg:
>     EGG-INFO  sqlalchemy
>   SQLAlchemy-0.4.0beta4-py2.5.egg-info:
>     dependency_links.txt  entry_points.txt  PKG-INFO  SOURCES.txt
>     top_level.txt
>   sqlalchemy (0.4.0)
>At this point I expect import sqlalchemy to import the 0.4 version and
>pkg_resources to give me access to 0.3.10 or 0.4.0beta4 depending on how
>I specify my versions.  But in fact, 0.4.0 is not available::
>   pkg_require >=0.3,<0.4.0beta1...  Traceback (most recent call last):
>     File "<string>", line 1, in <module>
>     File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 626,
>in require
>       needed = self.resolve(parse_requirements(requirements))
>     File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 528,
>in resolve
>       raise VersionConflict(dist,req) # XXX put more info here
>   pkg_resources.VersionConflict: (SQLAlchemy 0.4.0beta4
>This also happens when I use *.pth files instead of installing 0.4 as an
>active egg.

I'm not sure what you mean by using .pth files here.  If you did the 
easy_install without the '-m', that would make the 0.3 version the 
active (default) version, though, and it would override the 
default-active 0.4 version.

>Is this a bug?

Not really.  Once pkg_resources has been imported, it's too late to 
request an inactive version that conflicts with an active version of 
the same project, as the default working set has already been 
configured by that time.

However, if you create a project that depends on the 0.3 SQLAlchemy, 
and run a script from that project, it will see the correct 
version.  pkg_resources can resolve the version conflict 
automatically under those circumstances.

Anyway, the point here is that a default version is a default 
version, period.  The only way it can be overridden is by a 
conflicting requirement defined for a script.

More information about the Distutils-SIG mailing list