[Tutor] pip install lxml fails

Peter Otten __peter__ at web.de
Thu Apr 9 22:26:46 CEST 2015


Stefan Behnel wrote:

> Alex Kleider schrieb am 09.04.2015 um 21:49:
>> On 2015-04-09 09:11, Stefan Behnel wrote:
>>> All you need to do is install the "-dev" package that goes with your
>>> Python installation, e.g. "python3-dev" should match Python 3.4 in
>>> current Ubuntu releases.
>>>
>>> The reason why it's in a separate package is that many people actually
>>> don't need this, e.g. when they only install plain Python packages or
>>> use the Ubuntu provided binary packages that they can install via apt
>>> (e.g. "sudo apt-get install python-lxml").
>> 
>> Thanks Brandon and Sefan.  It proved correct that I did not have
>> python3-dev installed
>> .. but after intalling it, the pip install lxml still fails!
>> 
>> There's a huge amount of output but what follows might provide clues as
>> to the current problem:
>> [...]
>> /usr/bin/ld: cannot find -lz
> 
> Same thing, you need to make zlib available to the build. Ubuntu calls the
> package "zlib1g-dev". And while you're at it, make sure you also have
> "libxml2-dev" and "libxslt-dev".
> 
> The official installation instructions can be found here, BTW:
> 
> http://lxml.de/installation.html

I'd try

$ sudo apt-get build-dep python3-lxml

This should install all build dependencies of the python3-lxml package which 
are likely the same as those of a manual installation of lxml.



More information about the Tutor mailing list