3

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
Victor Shytiuk
  • 119
  • 1
  • 2
  • 8
  • There is a some required packages missing problem. Please install this packages to your system.I'm using centos and i have install it using yum command. `libxml2 libxml2-devel libxslt libxslt-devel` – waruna k Oct 23 '19 at 09:43

4 Answers4

4

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.

matagus
  • 6,136
  • 2
  • 26
  • 39
0

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

Community
  • 1
  • 1
Ehvince
  • 17,274
  • 7
  • 58
  • 79
0

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
Community
  • 1
  • 1
Oliver Kocsis
  • 633
  • 1
  • 6
  • 12
0

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!

Will Flowers
  • 101
  • 6