Victor Shytiuk
Victor Shytiuk

Reputation: 129

Installing lxml in virtualenv via pip install error: command 'x86_64-linux-gnu-gcc' failed

when I activate virtualenv and type 'pip install lxml' installation process crashes with message:

/usr/bin/ld: cannot find -lz

collect2: error: ld returned 1 exit status

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Upvotes: 3

Views: 5680

Answers (4)

Will Flowers
Will Flowers

Reputation: 121

For RHEL7/Fedora/CentOS in order to install lxml you need to:

YUM/DNF install libxml2 libxslt

...and possibly:

YUM/DNF install libxslt-devel libxml2-devel

Cheers!

Upvotes: 0

Oliver Kocsis
Oliver Kocsis

Reputation: 613

From https://askubuntu.com/questions/627140/cannot-install-lxml-on-ubuntu-14

sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev python3-pip

Upvotes: 0

Ehvince
Ehvince

Reputation: 18395

Installing those dependencies fixed it for me (Debian 7):

sudo apt-get install libxml2-dev libxslt1-dev

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

Upvotes: 0

matagus
matagus

Reputation: 6206

The error you have to pay attention to is the first "/usr/bin/ld: cannot find -lz": tnhat means you don't have zlib-dev installed. Depending on your linux distribution it could be named zlib-dev or zlib1g-dev in Ubuntu, I don't know in other distros.

Upvotes: 4

Related Questions