Re: several version of eggs

cedric briner <work-W/[email protected]>
Newsgroups gmane.comp.python.peak
Message-ID <[email protected]>
 >> Hello,
 >>
########################################
1 ######################################
########################################

 >> I thought that with eggs, I will be able to choose at run time, which
 >> version of an egg I would like to use.
 >
 > You must install them using the --multi-version (-m) option of
 > easy_install.

Someone told me the same on comp.lang.python. So I didn't uninstall it, 
but I've just redo a:
$ easy_install -m 'SQLAlchemy==0.4.6'
...
$ easy_install -m 'SQLAlchemy==0.4.4'
...

check that the easy-install.pth doesn't contain any more some sql
entry:
$ grep -i sql /home/system/briner/py-lib/easy-install.pth
./SQLObject-0.9.4-py2.4.egg
no more sqlachemy in it

and now it still not work as desired.

$ python
 >>> import pkg_resources
 >>> pkg_resources.require("SQLAlchemy==0.4.4")

[SQLAlchemy 0.4.4 (/home/system/briner/py-lib/SQLAlchemy-0.4.4-
py2.5.egg)]
 >>> pkg_resources.require("SQLAlchemy==0.4.6")

Traceback (most recent call last):
   File "<stdin>", 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.4 (/home/system/briner/
py-lib/SQLAlchemy-0.4.4-py2.5.egg),
Requirement.parse('SQLAlchemy==0.4.6'))

CTRL+D

So it seems that we still have the same behavior as described before.


.....
I must recognize that I get my hand dirty trying to understand how this 
stuff worked. by removing some bad installation in the past.

What I do have now is:

-----------------

$ cd /usr/lib/python2.5
$ find ./ -name \*pth
./site-packages/PIL.pth           Image Library
./site-packages/Numeric.pth       Scientific stuff
./site-packages/altinstall.pth    EasyInstall#administrator-installation
./site-packages/wx.pth            Scientific stuff
./site-packages/python-support.pth automated rebuilding support
./site-packages/pygst.pth         GStreamer Stuff

$ more /usr/lib/python2.5/site-packages/altinstall.pth
import site; site.addsitedir('/home/system/briner/py-lib')

-----------------

$ ls -ld ~/.py*
drwxr-xr-x ... /home/system/briner/.pybackpack
-rw-r--r-- ... /home/system/briner/.pydistutils.cfg
drwxr-xr-x ... /home/system/briner/.python-eggs

$ more /home/system/briner/.pydistutils.cfg
[install]
install_lib = ~/py-lib
install_scripts = ~/bin

-----------------

$ ls -l ~/py-lib
drwxr-xr-x ... Cheetah-2.0.1-py2.4-linux-i686.egg
drwxr-xr-x ... Cheetah-2.0.1-py2.5-linux-x86_64.egg
drwxr-xr-x ... CherryPy-2.3.0-py2.4.egg
drwxr-xr-x ... CherryPy-2.3.0-py2.5.egg
drwxr-xr-x ... configobj-4.3.2-py2.4.egg
-rw-r--r-- ... configobj-4.5.2-py2.5.egg
-rw-r--r-- ... DecoratorTools-1.7-py2.4.egg
-rw-r--r-- ... DecoratorTools-1.7-py2.5.egg
-rw-r--r-- ... easy-install.pth
drwxr-xr-x ... foo-0.3dev-py2.5.egg
drwxr-xr-x ... foo-0.4dev-py2.5.egg
drwxr-xr-x ... FormEncode-0.9-py2.4.egg
drwxr-xr-x ... FormEncode-1.0.1-py2.5.egg
drwxr-xr-x ... fw_obsge_0.1
drwxr-xr-x ... fw_obsge_0.2
-rw-r--r-- ... Genshi-0.4.4-py2.4.egg
drwxr-xr-x ... gsquickstart-1.0-py2.4.egg
drwxr-xr-x ... IPy-0.56-py2.4.egg
drwxr-xr-x ... jquery-1.2.3-py2.4.egg
drwxr-xr-x ... kid-0.9.6-py2.4.egg
drwxr-xr-x ... kid-0.9.6-py2.5.egg
drwxr-xr-x ... Paste-1.6-py2.4.egg
drwxr-xr-x ... Paste-1.7-py2.5.egg
drwxr-xr-x ... PasteDeploy-1.3.1-py2.4.egg
drwxr-xr-x ... PasteDeploy-1.3.1-py2.5.egg
-rwxr-xr-x ... paster
drwxr-xr-x ... PasteScript-1.6.2-py2.4.egg
drwxr-xr-x ... PasteScript-1.6.2-py2.5.egg
-rw-r--r-- ... PyProtocols-1.0a0dev_r2302-py2.5-linux-x86_64.egg
-rw-r--r-- ... PyProtocols-1.0a0-py2.4-linux-i686.egg
-rw-r--r-- ... rdiff_backup-1.0.5-py2.5-linux-x86_64.egg
-rw-r--r-- ... RuleDispatch-0.5a0.dev_r2306-py2.4-linux-i686.egg
-rw-r--r-- ... RuleDispatch-0.5a0.dev_r2306-py2.5-linux-x86_64.egg
drwxr-xr-x ... setuptools-0.6c8-py2.4.egg
-rw-r--r-- ... setuptools-0.6c8-py2.5.egg
-rw-r--r-- ... setuptools.pth
-rw-r--r-- ... simplejson-1.7.4-py2.4-linux-i686.egg
-rw-r--r-- ... simplejson-1.9.1-py2.5-linux-x86_64.egg
-rw-r--r-- ... site.py
drwxr-xr-x ... SQLAlchemy-0.4.4-py2.4.egg
drwxr-xr-x ... SQLAlchemy-0.4.4-py2.5.egg
drwxr-xr-x ... SQLAlchemy-0.4.6-py2.5.egg
drwxr-xr-x ... SQLObject-0.9.4-py2.4.egg
drwxr-xr-x ... TurboCheetah-1.0-py2.4.egg
drwxr-xr-x ... TurboCheetah-1.0-py2.5.egg
drwxr-xr-x ... TurboGears-1.0.4.4-py2.4.egg
drwxr-xr-x ... TurboGears-1.0.4.4-py2.5.egg
drwxr-xr-x ... TurboJson-1.1.2-py2.4.egg
drwxr-xr-x ... TurboJson-1.1.2-py2.5.egg
drwxr-xr-x ... TurboKid-1.0.4-py2.4.egg
drwxr-xr-x ... TurboKid-1.0.4-py2.5.egg

$ more ~/py-lib/easy-install.pth
import sys; sys.__plen = len(sys.path)
./SQLObject-0.9.4-py2.4.egg
./Genshi-0.4.4-py2.4.egg
./gsquickstart-1.0-py2.4.egg
./jquery-1.2.3-py2.4.egg
./IPy-0.56-py2.4.egg
./TurboGears-1.0.4.4-py2.5.egg
./TurboKid-1.0.4-py2.5.egg
./TurboJson-1.1.2-py2.5.egg
./TurboCheetah-1.0-py2.5.egg
./simplejson-1.9.1-py2.5-linux-x86_64.egg
./setuptools-0.6c8-py2.5.egg
./RuleDispatch-0.5a0.dev_r2306-py2.5-linux-x86_64.egg
./PasteScript-1.6.2-py2.5.egg
./FormEncode-1.0.1-py2.5.egg
./DecoratorTools-1.7-py2.5.egg
./configobj-4.5.2-py2.5.egg
./CherryPy-2.3.0-py2.5.egg
./kid-0.9.6-py2.5.egg
./Cheetah-2.0.1-py2.5-linux-x86_64.egg
./PyProtocols-1.0a0dev_r2302-py2.5-linux-x86_64.egg
./PasteDeploy-1.3.1-py2.5.egg
./Paste-1.7-py2.5.egg
./rdiff_backup-1.0.5-py2.5-linux-x86_64.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; 
p=getattr(sys,'__egginsert',0); sys.path[p:p
]=new; sys.__egginsert = p+len(new)


-----------------

$ more `which easy_install`
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 
'setuptools==0.6c8','console_scripts','easy_install'
__requires__ = 'setuptools==0.6c8'
import sys
from pkg_resources import load_entry_point

sys.exit(
    load_entry_point('setuptools==0.6c8', 'console_scripts', 
'easy_install')()
)

 >
 >> so it feels that the only package I can call is the latest one
 >> installed !!!
 >
 > If the last one you install is installed with -m, you'll be able to use
 > whichever you want, but you will always have to use require() to import
 > *any* of them.
that's fine with me.
 >

########################################
2 ######################################
########################################

 > If you want to be able to use any version, any time, then you need to
 > package the code that's doing that with its own setup.py, requirements,
 > and entry point scripts.  Such scripts can use whatever version they
 > want, even if not installed with -m.  See the setuptools manual for more
 > information on this.
sorry, but I'm a bit lost now... I'll try to understand this, when the 
problem aboved the '####' will be solved

Anyway I'll give a look at it !


So do you mean that if I do install two version of the same module, I 
can only use the last one installed (timely speaking).
And that if I'd like to use the former version, I have to package my 
scripts into an egg
Thanks for the information, I'll have a look .

########################################
3 ######################################
########################################
Do you have some small example to test, because it is always much more 
easier to learn and understand with example that works :) (because my don't)


cEd
-- 

Cedric BRINER
Geneva - Switzerland
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.