Muffinresearch Labs by Stuart Colville

Install lxml on OSX | 4 Comments

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

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

  • http://yacitus.com Daryl Spitzer

    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)

  • http://muffinresearch.co.uk Stuart Colville

    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″

  • gr.mon

    Freaking awesome!

  • gr.mon

     that is, if it worked til the end. seemed to work but aborted w an error 256

Insert a tab character in vim when expand tabs is on|(0)

I have vim set-up to use spaces in place of tabs. Sometimes you need to use an actual tab e.g. editing a Makefile. Now whilst it’s possible to change settings so that tabs are used for specific files, a quick tip to remember is to simply type in insert mode:

Ctrl+v tab

That is Ctrl and “V” and hit the tab key, et voila you’ve entered an actual tab.

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

Photos on Flickr

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