[Distutils] IBM Developerworks setuptools article - example doesnt work ?

Michael Bayer mike_mp at zzzcomputing.com
Mon Oct 30 20:43:32 CET 2006


I just read an IBM Developerworks article on setuptools today, its  
linked at:

http://www-128.ibm.com/developerworks/linux/library/l-cppeak3.html? 
ca=dgr-lnxw07PythonEggWithSetuptools

it refers to the ability to use pkg_resources.require() in a Python  
script to specify any particular version of a package that happens to  
exist in site-packages, overriding the currently active  
package...something i used to think setuptools could do, but then  
figured it couldnt (even though it seems like obviously useful  
functionality), and it seems that it still cannot.  from the  
article's example:

# install Gnosis_Utils (latest version is 1.2.1)
easy_install -f http://gnosis.cx/download/Gnosis_Utils.More/  
Gnosis_Utils

# install version 1.2.0 of Gnosis_Utils
easy_install -f http://gnosis.cx/download/Gnosis_Utils.More/   
"Gnosis_Utils==1.2.0"

# re-activate version 1.2.1
easy_install "Gnosis_Utils==1.2.1"

# run a script that requires version 1.2.0
from pkg_resources import require
require("Gnosis_Utils==1.2.0")

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/setuptools-0.6c3-py2.4.egg/pkg_resources.py",  
line 585, in require
     needed = self.resolve(parse_requirements(requirements))
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/setuptools-0.6c3-py2.4.egg/pkg_resources.py",  
line 487, in resolve
     raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (Gnosis-Utils 1.2.1 (/Library/ 
Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ 
Gnosis_Utils-1.2.1-py2.4.egg), Requirement.parse('Gnosis-Utils==1.2.0'))


bug ?  or feature ?





More information about the Distutils-SIG mailing list