From: srid on
Much of these non-trivial build steps are abstracted in the
ActiveState build repository.

1. Download ActivePython: http://www.activestate.com/activepython/
2. Run "pypm install lxml" (on Mac, Linux or Windows)

$ pypm install lxml
Ready to perform these actions:
The following packages will be installed:
lxml-2.2.2
Get: [pypm.activestate.com] lxml 2.2.2-2
Installing lxml-2.2.2
$ python -c "import lxml; print lxml.__file__"
/Users/sridharr/.local/lib/python2.6/site-packages/lxml/__init__.py
$

-srid


On Nov 11, 4:49 am, 7stud <bbxx789_0...(a)yahoo.com> wrote:
> I'm trying to installlxml, but I can't figure out the installation
> instructions.  Here:
>
> http://codespeak.net/lxml/installation.html
>
> it says:
>
> 1) Get the easy_install tool.
>
> Ok, I went to the easy_install website, downloaded, and installed it.
> The last two lines of the output during installation said this:
>
> Installingeasy_install script to /Library/Frameworks/Python.framework/
> Versions/2.6/binInstallingeasy_install-2.6 script to /Library/Frameworks/
> Python.framework/Versions/2.6/bin
>
> 2) ...run the following as super-user (or administrator):
>
> easy_installlxml
>
> 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_installlxml==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_installlxml
>
> -----------
>
> My os is mac os x 10.4.11.   But this:
>
> STATIC_DEPS=true easy_installlxml
>
> is not a valid command:
>
> $ sudo STATIC_DEPS=true easy_installlxml
> Password:
> sudo: STATIC_DEPS=true: command not found
>
> In any case, if I do this:
>
> $ sudo easy_installlxml
> sudo: easy_install: command not found
>
> In other words, when I installed easy_install it did not add anything
> to my PATH which points to the installation directory mentioned during
> installation:
>
> Installingeasy_install script to /Library/Frameworks/Python.framework/
> Versions/2.6/bin
>
> Ok, so I need to use the full path to the easy_install program (which
> is not mentioned ANYWHERE in the installation instructions), i.e.
>
> /Library/Frameworks/Python.framework/Versions/2.6/bin/easy_install
>
> ...but this still isn't going to work:
>
> $ sudo STATIC_DEPS=true /Library/Frameworks/Python.framework/Versions/
> 2.6/bin/easy_installlxml
> Password:
> sudo: STATIC_DEPS=true: command not found
>
> So what the heck is going on??
>
> Attention developers: you may be one of the best programmers in the
> world, but if you can't convey how to use your software to the average
> user, then you are the equivalent of one of the worst programmers on
> the planet.

From: srid on
On Nov 11, 6:54 am, 7stud <bbxx789_0...(a)yahoo.com> wrote:
>
> Unfortunately, easy_install was not able to installlxml!  Here is the
> output:
>
> ---
> $ sudo STATIC_DEPS=true /Library/Frameworks/Python.framework/Versions/
> 2.6/bin/easy_installlxml
> Password:
> sudo: STATIC_DEPS=true: command not found
> $ STATIC_DEPS=true sudo /Library/Frameworks/Python.framework/Versions/
> 2.6/bin/easy_installlxml
> Password:
> Searching forlxml
> Readinghttp://pypi.python.org/simple/lxml/
> Readinghttp://codespeak.net/lxml
> Best match:lxml2.2.3
> Downloadinghttp://codespeak.net/lxml/lxml-2.2.3.tgz
> Processinglxml-2.2.3.tgz
> Runninglxml-2.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-
> r2obQa/lxml-2.2.3/egg-dist-tmp-7v5A1n
> Buildinglxmlversion 2.2.3.
> Traceback (most recent call last):
>   File "/Library/Frameworks/Python.framework/Versions/2.6/bin/
> easy_install", line 8, in <module>
>     load_entry_point('setuptools==0.6c11', 'console_scripts',
> 'easy_install')()
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 1712, in main
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 1700, in with_ei_usage
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 1716, in <lambda>
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/distutils/core.py", line 152, in setup
>     dist.run_commands()
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/distutils/dist.py", line 975, in run_commands
>     self.run_command(cmd)
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/distutils/dist.py", line 995, in run_command
>     cmd_obj.run()
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 211, in run
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 446, in easy_install
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 476, in install_item
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 655, in install_eggs
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 930, in build_and_install
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/
> easy_install.py", line 919, in run_setup
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/
> sandbox.py", line 62, in run_setup
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/
> sandbox.py", line 105, in run
>   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/
> sandbox.py", line 64, in <lambda>
>   File "setup.py", line 119, in <module>
>
>   File "/tmp/easy_install-r2obQa/lxml-2.2.3/setupinfo.py", line 51, in
> ext_modules
> TypeError: build_libxml2xslt() got an unexpected keyword argument
> 'libiconv_version'

https://bugs.launchpad.net/lxml/+bug/480225

-srid

From: Terry Reedy on
7stud wrote:
> On Nov 11, 7:37 am, "Diez B. Roggisch" <de...(a)nospam.web.de> 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:

http://codespeak.net/lxml/installation.html
"

>> 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:
>>
>> http://codespeak.net/lxml/build.html#building-lxml-on-macos-x
>>
>> Which contains the proper command
>>
>> STATIC_DEPS=true sudo easy_install lxml

And this is also true.

> 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, 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.

tjr



From: 7stud on
On Nov 11, 1:37 pm, Terry Reedy <tjre...(a)udel.edu> wrote:
> 7stud wrote:
> > On Nov 11, 7:37 am, "Diez B. Roggisch" <de...(a)nospam.web.de> 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:
>
> http://codespeak.net/lxml/installation.html
> "
>
> >> 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:
>
> >> http://codespeak.net/lxml/build.html#building-lxml-on-macos-x
>
> >> 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/
Versions/
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
instructions*.>>>

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


Requirements

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:
http://xmlsoft.org/downloads.html
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: http://xmlsoft.org/XSLT/downloads.html
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...>>>

Installation

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

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:

===
MacOS-X

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
.....
.....
MAC OS X:
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.





From: 7stud on
On Nov 11, 5:59 pm, 7stud <bbxx789_0...(a)yahoo.com> wrote:
>
> 1) Maybe the installation instructions for mac osx should read:
>
> ====
> Installation Instructions
> ....
> ....
> MAC OS X:
> 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.
>


....and most importantly:

4) The path to easy_install may not get added to your PATH environment
variable, so using the full path to easy_install might be necessary
when issuing the easy_install command. If you get an error that says:

easy_install: command not found

then you will need to use the full path to easy_install. Some
installs will put easy_install here:

/Library/Frameworks/Python.framework/
Versions/2.6/bin/easy_install

Others will put it here:

.....

If can't locate easy_install in any of those directories, you can
locate easy_install using the find command:

find / -name easy_install