Installing Lxml With Pip In Virtualenv Ubuntu 12.10 Error: Command 'gcc' Failed With Exit Status 4
Solution 1:
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 557or sacrifice child
[3778136.277587] Killed process 21267 (cc1) total-vm:365836kB, anon-rss:336228kB, file-rss:0kB
Solution 2:
Here is the my saved note.
sudo apt-get install libxml2
sudo apt-get install libxslt1.1
sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
sudo apt-get install python-libxml2
sudo apt-get install python-libxslt1
sudo apt-get install python-dev
sudo apt-get install python-setuptools
easy_install lxml
It has worked for my ubuntu 12.10
Solution 3:
According to lxml site you could use such construction:
CFLAGS="-O0" pip install lxml
Note for those installing globally: The proper way to pass environment variables with sudo is aftersudo
:
sudo CFLAGS="-O0" pip install lxml
Solution 4:
I met the similar question(error: command 'gcc' failed with exit status 4) this morning. It seems you need check your machine's memory. If the memory is lower than 512M,that may be the cause.Try to close some services temporarily,like apache server,and try "pip install lxml" again.It maybe work!
Solution 5:
I've stumbled with this trouble a couple of times.
Short answer
Python2: $ python2.7 setup.py clean build --with-cython install
Python3: $ pip-3.3 install lxml
Long answer
The hypothesis is that pip install lxml
should work in every environment, regardless if you are using Python2 or Python3.
There's also Cython
to be considered: You will certainly enjoy lxml
compiled with Cython
due to relevant performance gains.
For reasons unknown to me, the compilation on Python2 does not find Cython. To be more precise and absolutely explicit about this matter, both commands below DO NOT employ Cython:
# DO NOT use these commands. I repeat: DO NOT use these commands.$ pip-2.7 install lxml
$ easy_install-2.7 install lxml
So, when using Python2 you have only one alternative, as far as I know, which is: compile from sources, Luke!
# install build environment and dependencies$ kernel_release=$( uname -r )$ sudo apt-get install linux-headers-${kernel_release} build-essential -y$ sudo apt-get install libxml2-dev libxslt1-dev -y
# Download from github and compile from sources$ git clone --branch lxml-3.2.4 https://github.com/lxml/lxml$ python2.7 setup.py clean build --with-cython install
Post a Comment for "Installing Lxml With Pip In Virtualenv Ubuntu 12.10 Error: Command 'gcc' Failed With Exit Status 4"