[Distutils] setuptools: Missing unmanaged module warning; Failed SVN cleanup; Wrong version in .egg name

John J Lee jjl at pobox.com
Tue Nov 1 02:50:37 CET 2005

On Mon, 31 Oct 2005, Phillip J. Eby wrote:

> At 11:25 PM 10/31/2005 +0000, John J Lee wrote:
> >I eagerly anticipate the day when .require() installs at the start of
> >sys.path.
> It's not going to do that, but as of 0.6a6 eggs are placed before the 
> directory that *contains* them on sys.path.  So, if you require an egg 
> that's in site-packages, it will be added just before site-packages in 
> sys.path, thus preventing unmanaged packages from interfering.

That does not prevent unmanaged packages from interfering.

For example, I happen to have an SVN copy of module ClientForm installed
fairly early on in sys.path on a Windows machine at work (from PYTHONPATH
or a .pth or what else I don't recall offhand), and that, unsurprisingly,
is what I get when I "import ClientForm" from an interactive prompt.  
setuptools inserts its sys.path entry *after* the place where my ad-hoc
sys.path entry happens to have ended up, so even immediately after a
pkg_resources.require("ClientForm==0.2.1a"), I still get my old SVN
working copy picked up when I "import ClientForm".

I don't always get a conflict warning even here on this linux box
(setuptools 0.6a7):

dev[0]$ python
Python 2.3.4 (#1, Feb 19 2005, 23:24:45)
[GCC 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mechanize
>>> mechanize.__file__
dev[0]$ easy_install -d . -m mechanize
Searching for mechanize
Reading http://www.python.org/pypi/mechanize/
Reading http://wwwsearch.sourceforge.net/mechanize/
Best match: mechanize 0.0.9a
Processing mechanize-0.0.9a.tar.gz
Running mechanize-0.0.9a/setup.py -q bdist_egg --dist-dir 
zip_safe flag not set; analyzing archive contents...

Installed /hda/usr/local/buf/comp/dev/mechanize-0.0.9a-py2.3.egg

Because this distribution was installed --multi-version or --install-dir,
before you can import modules from this package in an application, you
will need to 'import pkg_resources' and then use a 'require()' call
similar to one of these examples, in order to select the desired version:

    pkg_resources.require("mechanize")  # latest installed version
    pkg_resources.require("mechanize==0.0.9a")  # this exact version
    pkg_resources.require("mechanize>=0.0.9a")  # this version or higher

Note also that the installation directory must be on sys.path at runtime 
this to work.  (e.g. by being the application's script directory, by being 
PYTHONPATH, or by being added to sys.path by your code.)

Processing dependencies for mechanize

No conflict warning!  OTOH, I DO get a conflict warning for:

dev[0]$ easy_install -d . -m ClientForm

But again, NO conflict warning for:

dev[0]$ easy_install -d . -m 'mechanize==dev'

> >   Do I understand correctly that, when this happens, we will in
> >practice be able to do
> >
> >pkg_resources.require("smth==1.1")
> >import smth
> >
> >
> >and be confident that we do indeed have module smth version 1.1?
> That's the case now; it's just that you can always get a 
> DistributionNotFound (if it's not available) or a VersionConflict (if 
> another version has already been activated).

... or just, silently, some entirely different version of the module that
I installed before I'd even heard of eggs.

What am I doing wrong?

I'm also scratching my head over why easy_install does not oes not install
dependencies for Cheese Shop-registered module mechanize, but that's
probably just a job for tomorrow and some coffee :-)

easy_install 'mechanize==dev'

--> grabs and installs mechanize from SVN, but not its dependencies,
despite my (committed!) setup.py requesting otherwise...

    "ClientForm>=0.2.1", "ClientCookie>=1.0.3", "pullparser>=0.0.4"]
NAME = "mechanize"


    name = NAME,
    version = VERSION,
    license = LICENSE,
    platforms = PLATFORMS,
    classifiers = [c for c in CLASSIFIERS.split("\n") if c],
    install_requires = INSTALL_REQUIRES,
    zip_safe = ZIP_SAFE,
    test_suite = "test",
    author = "John J. Lee",
    author_email = "jjl at pobox.com",
    description = doclines[0],
    long_description = "\n".join(doclines[2:]),
    url = "http://wwwsearch.sourceforge.net/%s/" % NAME,
    download_url = ("http://wwwsearch.sourceforge.net/%s/src/"
                    "%s-%s.tar.gz" % (NAME, NAME, VERSION)),
    py_modules = py_modules,
    packages = packages,

BTW, this work of yours looks really promising, which is why I'm doing
this in the first place, of course.


More information about the Distutils-SIG mailing list