[Distutils] eggs and import order

skip at pobox.com skip at pobox.com
Wed Oct 29 17:40:46 CET 2008


Way back when I installed SQLalchemy 0.3.3 in such a way that it wound up in
.../site-packages/easy-install.pth:

    ...
    ./SQLAlchemy-0.3.3-py2.4.egg
    ...

A colleague installed a later version in a different directory, referenced
that in PYTHONPATH but still got the old version:

    udesktop116% PYTHONPATH=/opt/tradelink/research/site-packages.beta python -c 'import sqlalchemy ; print sqlalchemy.__file__'
    /opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/SQLAlchemy-0.3.3-py2.4.egg/sqlalchemy/__init__.pyc
    udesktop116% ls /opt/tradelink/research/site-packages.beta
    BeautifulSoup.py                        _mssql.so               pylab.py
    Cython                                  configobj.py            pylab.pyc
    IPython                                 dateutil                pymssql.py
    Jinja-1.2-py2.4-solaris-2.10-i86pc.egg  docutils-0.4-py2.4.egg  pymssql.pyc
    PIL                                     easy-install.pth        pyparsing.py
    PIL.pth                                 enthought               pytz
    Pygments-0.10-py2.4.egg                 fpconst.py              pyximport
    Pyrex                                   fpconst.pyc             research
    SOAPpy                                  lib                     scipy
    SQLAlchemy-0.5.0rc3dev_r5205-py2.4.egg  matplotlib              timeseries
    Sphinx-0.3-py2.4.egg                    mpl_toolkits            tlsec
    Symbide-0.3.1-py2.4.egg                 numpy
    __init__.py                             pyExcelerator

Looking at sys.path shows why:

    PYTHONPATH=/opt/tradelink/research/site-packages.beta python -c 'import sys ; print sys.path'
    ['',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/zope.interface-3.3.0-py2.4-solaris-2.10-i86pc.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/pycrypto-2.0.1-py2.4-solaris-2.10-i86pc.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/magnitude-0.9.3-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/paramiko-1.7.2-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/processing-0.52-py2.4-solaris-2.10-i86pc.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/pp-1.5.4-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/greenlet-0.1-py2.4-solaris-2.10-i86pc.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/MDP-2.3-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/hashlib-20060408a-py2.4-solaris-2.10-i86pc.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/nose-0.10.3-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/coverage-2.85-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/daemon-1.0.1-py2.4.egg',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/SQLAlchemy-0.3.3-py2.4.egg',
    '/opt/tradelink/research/site-packages.beta',
    '/opt/app/g++lib6/python-2.4/lib/python24.zip',
    '/opt/app/g++lib6/python-2.4/lib/python2.4',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/plat-sunos5',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/lib-tk',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/lib-dynload',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/3rdParty',
    '/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/3rdParty/Numeric']

The beta site-packages directory does indeed appear ahead of the normal
site-packages, but the contents of easy-install.pth are all ahead of that.
In my opinion they should be inserted right before the directory in which
their .pth file was found.  Why is this not the case?

In case it's a setuptools/easy_install thing, I'm using setuptools 0.6c7
with Python 2.4.5.

Thanks,

Skip


More information about the Distutils-SIG mailing list