Cannot Install Lxml on Ubuntu 14

Cannot Install Lxml on Ubuntu 14

I have problems installing lxml on my virtual machine, cloud server, Ubuntu 14.04.2 with 512MB RAM. For people that are going through this, I will document little steps of problems that occurred on the path.

First I didn't install requirements, so make sure you have that installed. Can be found here.

Then I had some problems with memory, because 512MB were insufficient. Excellent post on how to extend your RAMS with swap can be found here.

Now I'm facing new problem. While trying to execute sudo pip install lxml.

In pip.log I've found this messsage:

/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

Is it some "z" module that I'm missing? What am I supposed to do?

1 Answer

Ok, I've found what was missing.

Here you can find in one answer, that in all the requirements are actually these ones:

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

After that, you can safely do sudo pip install lxml

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.