views:

1144

answers:

2

I try to:

easy_install lxml

and I get this error:

File "build/bdist.macosx-10.3-fat/egg/setuptools/command/build_ext.py", line 85, in get_ext_filename KeyError: 'etree'

any hints?

+6  A: 

Due to incompatible changes in the 2.6.3 version of python's distutils, the old easy_install from setuptools no longer works. You need to replace it with easy_install from Distribute. Follow the instructions there, basically:

$ curl -O http://nightly.ziade.org/distribute_setup.py
$ python distribute_setup.py

assuming the 2.6.3 python is first on your $PATH.

EDIT: Besides the option to migrate from setuptools to Distribute, Python 2.6.4, which should be released in a couple of weeks, will contain a workaround in distutils that will unbreak setuptools. Thanks, Tarek, for the fix and thanks, jbastos, for bringing this issue up.

FURTHER EDIT: setuptools itself has been updated (as of 0.6c10) to work around the problem with 2.6.3.

Ned Deily
I did this, but now I get another error >In file included from libxml.h:53,> from SAX.c:12:>trio.h:37:19: error: stdio.h: No such file or directory
jbastos
Do you have the optional 10.4 SDK installed from Xcode? ls /Developer/SDKs/MacOSX10.4u.sdk/ What's the output of xml2-config --libs --prefix ?
Ned Deily
In fact, if you have setuptools installed you can simply easy_install Distribute. The Distribute installation doesn't seem to trigger the bug.
Lennart Regebro
Done - I had to install Xcode 10.4 compiler in order to install it. I had also installed cython and Distribute.
jbastos
+3  A: 

Ned :

incompatible changes in the 2.6.3 version of python's distutil

Not precisely. The API hasn't changed but Setuptools overrides them, and makes the assumption they are called in a particular order.

Lennart:

The Distribute installation doesn't seem to trigger the bug

Yes indeed, this precise bug was detected some time ago and fixed in Distribute (and in Ubuntu's setuptools package)

Tarek Ziadé
@Tarek: whether or not it is a good idea that Setuptools overrides them isn't the point. The fact is it does, it has for a long time, and now it doesn't work in 2.6.3 so users have to change what they have been doing and they have no way of knowing that. Moving from setuptools to Distribute is fine, but users of easy_install need to know they have to do that
Ned Deily
@Ned: So we tell them. :)
Lennart Regebro