Installing lxml with pip in virtualenv Ubuntu 12.10 error: command 'gcc' failed with exit status 4 Installing lxml with pip in virtualenv Ubuntu 12.10 error: command 'gcc' failed with exit status 4 python python

Installing lxml with pip in virtualenv Ubuntu 12.10 error: command 'gcc' failed with exit status 4


Make sure you have enough memory. Try dmesg | tail to see if it outputs something like:

...[3778136.277570] Out of memory: Kill process 21267 (cc1) score 557 or sacrifice child[3778136.277587] Killed process 21267 (cc1) total-vm:365836kB, anon-rss:336228kB, file-rss:0kB


Here is the my saved note.

sudo apt-get install libxml2sudo apt-get install libxslt1.1sudo apt-get install libxml2-devsudo apt-get install libxslt1-devsudo apt-get install python-libxml2sudo apt-get install python-libxslt1sudo apt-get install python-devsudo apt-get install python-setuptoolseasy_install lxml

It has worked for my ubuntu 12.10


According to lxml site you could use such construction:

CFLAGS="-O0"  pip install lxml

installation guide

Note for those installing globally: The proper way to pass environment variables with sudo is after sudo:

sudo CFLAGS="-O0" pip install lxml