Blog: PHP, Python, Linux, Web services & Continuous delivery

Problems installing the python lxml package

If your trying to install the python lxml package (specifically on Debian but this probably applies to other distros too) using either pip or easy_install and get messages like the following


From easy_install:

Processing dependencies for scrapy

Searching for lxml



error: None

From pip:


gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w

In file included from src/lxml/lxml.etree.c:239:0:

src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

It's not obvious from the messages but chances are you need to install the following dev packages.

  • python2.7-dev
  • libxml2-dev
  • libxslt-dev
comments powered by Disqus