installing lxml ?

7stud bbxx789_05ss at
Thu Nov 12 01:59:51 CET 2009

On Nov 11, 1:37 pm, Terry Reedy <tjre... at> wrote:
> 7stud wrote:
> > On Nov 11, 7:37 am, "Diez B. Roggisch" <de... at> wrote:
> >> And third,
> >> there are limits to what extend one can anticipate the ineptness of
> Calling you inept was unnecessary, but....
> >> others to read. The page you cite from starts with:
> You wrote
> "
> I'm trying to install lxml, but I can't figure out the installation
> instructions.  Here:
> "
> >>    For special installation instructions regarding MS Windows and
> >> MacOS-X, see below.
> and that page indeed begins with the words above.

> >> And below you find this link:
> >>
> >> Which contains the proper command
> >>    STATIC_DEPS=true sudo easy_install lxml
> And this is also true.

Is it?  First, that in fact was not the proper command.  I posted the
actual command I had to issue in my previous post:

$ sudo STATIC_DEPS=true /Library/Frameworks/Python.framework/
2.6/bin/easy_install lxml

Shall I continue?  Here is what the top of the web page that contains
the installation instructions looks like (with my comments inserted in
the text):


For special installation instructions regarding MS Windows and MacOS-
X, see below.

<<<****Ok, now I'm scrolling down looking for the *installation

1 Requirements
2 Installation
3 Installation in ActivePython
4 Building lxml from sources
5 MS Windows
6 MacOS-X


You need Python 2.3 or later.
Unless you are using a static binary distribution (e.g. a Windows
binary egg from PyPI), you need to install libxml2 and libxslt, in
particular: libxml 2.6.21 or later. It can be found here:
If you want to use XPath, do not use libxml2 2.6.27. We recommend
libxml2 2.7.2 or later.
libxslt 1.1.15 or later. It can be found here:
Newer versions generally contain less bugs and are therefore
recommended. XML Schema support is also still worked on in libxml2, so
newer versions will give you better complience with the W3C spec.

<<<***Ok, I better read the requirements.  Uhg, those dependencies
look ugly.  Things are looking doubtful at this point.  Back to
looking for those special installation instructions for mac os x...>>>


Get the easy_install tool and run the following as super-user (or

easy_install lxml

On MS Windows, the above will install the binary builds that we
provide. If there is no binary build of the latest release yet, please
search PyPI for the last release that has them and pass that version
to easy_install like this:
easy_install lxml==2.2.2

On Linux (and most other well-behaved operating systems), easy_install
will manage to build the source distribution as long as libxml2 and
libxslt are properly installed, including development packages, i.e.
header files, etc. Use your package management tool to look for
packages like libxml2-dev or libxslt-devel if the build fails, and
make sure they are installed.

On MacOS-X, use the following to build the source distribution, and
make sure you have a working Internet connection, as this will
download libxml2 and libxslt in order to build them:
STATIC_DEPS=true easy_install lxml

<<<***Ah, hah.  There are the special installation instructions for
mac os x.  I'm ready to go.  Uh oh, what the heck is the easy_install
tool?  Oh, that's a link hiding behind the bolded text(hmm...this
website has some usability issues). Time goes by, tetonic plates
shift...Ok, I've got the easy_install tool installed.  Let's install
lxml now.>>

> > Your characterization of that web page is so fraudulent that I can
> > only say one thing in response:  You are a damn liar.
> So this makes no sense.

If someone were viewing the web page containing the installation
instructions with a screen that was 2 feet high, AND they happened to
see the additional section buried at the bottom of the page, AND they
chose to skip over instructions in the installation section for some
reason, the first part of the section at the bottom of the page reads:


A macport of lxml is available. Try port install py25-lxml.

If you want to use a more recent lxml release, you may have to build
it yourself. Apple doesn't help here, as the system libraries of
libxml2 and libxslt installed under MacOS-X are horribly outdated, and
***updating them is everything but easy***. In any case, you cannot
run lxml 2.x with the system provided libraries, so you have to use
newer libraries...

...which would probably make their eyes roll back in their head, or
dissuade them from reading any further, and therefore they would
return to the relevant installation instructions.  I, in fact, was not
viewing the web page with a screen that was two feet high, therefore
that section wasn't even visible when I was looking at the special
installation instructions for mac osx.

> If, when you have calmed down a bit, you have
> suggestions for improving the installation instructions, that might be
> more constructive. The lxml developers have obviously gone to some
> effort to give comprehensible instructions. Writing such is not easy. So
> if they have failed in your case, feedback might be considered.

That harks back to an earlier point that was made:

Benjamin Kaplan wrote:
> 1) It's not Python's fault that OS X doesn't add things to the path
> when its in a framework (like Python).

1) Maybe the installation instructions for mac osx should read:

Installation Instructions
We're not sure how mac osx works with easy_install.  Apple's system
installations of libxml and libxslt are pretty bad--and they are
difficult to upgrade.  As a result, the following instructions may or
may not work for you...

2) Stop proclaiming that lxml is cross platform and/or stop
recommending easy_install.

3) Don't split up relevant installation instructions over two web
pages and then bury the link connecting the two web pages at the
bottom of one of the pages.

In any case, thanks for all the help.  I'll stick to BeautifulSoup.

More information about the Python-list mailing list