Muffinresearch Labs by Stuart Colville

Install lxml on OSX | Comments (2)

Posted in Muffin Research Labs, Snippets on 5th March 2009, 11:10 pm by Stuart

Thanks to this post on lxml from Ian Bicking I’ve found the following command is all that’s required to install lxml on Mac OSX:

STATIC_DEPS=true easy_install 'lxml>=2.2beta4'
STATIC_DEPS=true sudo easy_install 'lxml>=2.2beta4'

The first run without “sudo” pulls down the necessary libxml and libxslt and then the second run provides the permissions to install the egg.

Post Tools

Comments: Add yours

1. On March 9th, 2010 at 12:28 am Daryl Spitzer said:

I get (on Mac OS X 10.5.8):

NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' needs to be available.
Using build configuration of libxslt 1.1.12
Building against libxml2/libxslt in the following directory: /usr/lib
src/lxml/lxml.etree.c:176:31: error: libxml/schematron.h: No such file or directory
src/lxml/lxml.etree.c:176:31: error: libxml/schematron.h: No such file or directory
src/lxml/lxml.etree.c:2022: error: syntax error before ‘xmlSchemaSAXPlugStruct’
src/lxml/lxml.etree.c:2024: error: syntax error before ‘}’ token
src/lxml/lxml.etree.c:2022: error: syntax error before ‘xmlSchemaSAXPlugStruct’
src/lxml/lxml.etree.c:2024: error: syntax error before ‘}’ token
src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_14_ParserContext___dealloc__’:
src/lxml/lxml.etree.c:63671: error: dereferencing pointer to incomplete type
src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_14_ParserContext__copy’:
src/lxml/lxml.etree.c:63763: error: dereferencing pointer to incomplete type

…and so on. (I got the same errors when trying:

python setup.py build --static-deps --libxml2-version=2.7.3  --libxslt-version=1.1.24
sudo python setup.py install

(from http://stackoverflow.com/questions/1277124/how-do-you-install-lxml-on-os-x-leopard-without-using-macports-or-fink)

2. On March 9th, 2010 at 7:03 am Stuart Colville said:

I don’t have a a mac anymore so I can’t test anything out for you. However a quick search turns this up http://osdir.com/ml/python.lxml.devel/2007-12/msg00001.html

The suggests that even though you’re specifying versions of libxml/libxslt it’s building against the stock mac versions anyway for some reason.

e.g: “Using build configuration of libxslt 1.1.12″







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(2)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.539s.