Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm having the following error when trying to run "pip install lxml" into a virtualenv in Ubuntu 12.10 x64. I have Python 2.7.

I have seen other related questions here about the same problem and tried installing python-dev, libxml2-dev and libxslt1-dev.

Please take a look of the traceback from the moment I tip the command to the moment when the error occurs.

 Downloading/unpacking lxml   Running setup.py egg_info for package lxml     /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'       warnings.warn(msg)     Building lxml version 3.1.2.     Building without Cython.     Using build configuration of libxslt 1.1.26     Building against libxml2/libxslt in the following directory: /usr/lib      warning: no files found matching '*.txt' under directory 'src/lxml/tests' Installing collected packages: lxml   Running setup.py install for lxml     /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'       warnings.warn(msg)     Building lxml version 3.1.2.     Building without Cython.     Using build configuration of libxslt 1.1.26     Building against libxml2/libxslt in the following directory: /usr/lib     building 'lxml.etree' extension     gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/.virtualenvs/dev.actualito.com/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o     src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__getFilenameForFile':     src/lxml/lxml.etree.c:26851:7: warning: variable '__pyx_clineno' set but not used [-Wunused-but-set-variable]     src/lxml/lxml.etree.c:26850:15: warning: variable '__pyx_filename' set but not used [-Wunused-but-set-variable]     src/lxml/lxml.etree.c:26849:7: warning: variable '__pyx_lineno' set but not used [-Wunused-but-set-variable]     src/lxml/lxml.etree.c: In function '__pyx_pf_4lxml_5etree_4XSLT_18__call__':     src/lxml/lxml.etree.c:138273:81: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]     src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'     src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__copyXSLT':     src/lxml/lxml.etree.c:139667:79: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]     src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'     src/lxml/lxml.etree.c: At top level:     src/lxml/lxml.etree.c:12384:13: warning: '__pyx_f_4lxml_5etree_displayNode' defined but not used [-Wunused-function]     gcc: internal compiler error: Killed (program cc1)     Please submit a full bug report,     with preprocessed source if appropriate.     See  for instructions.     error: command 'gcc' failed with exit status 4     Complete output from command /home/admin/.virtualenvs/dev.actualito.com/bin/python -c "import setuptools;__file__='/home/admin/.virtualenvs/dev.actualito.com/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-asDtN5-record/install-record.txt --single-version-externally-managed --install-headers /home/admin/.virtualenvs/dev.actualito.com/include/site/python2.7:     /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'    warnings.warn(msg)  Building lxml version 3.1.2.  Building without Cython.  Using build configuration of libxslt 1.1.26  Building against libxml2/libxslt in the following directory: /usr/lib  running install  running build  running build_py  copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes  running build_ext  building 'lxml.etree' extension  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/.virtualenvs/dev.actualito.com/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o  src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__getFilenameForFile':  src/lxml/lxml.etree.c:26851:7: warning: variable '__pyx_clineno' set but not used [-Wunused-but-set-variable]  src/lxml/lxml.etree.c:26850:15: warning: variable '__pyx_filename' set but not used [-Wunused-but-set-variable]  src/lxml/lxml.etree.c:26849:7: warning: variable '__pyx_lineno' set but not used [-Wunused-but-set-variable]  src/lxml/lxml.etree.c: In function '__pyx_pf_4lxml_5etree_4XSLT_18__call__':  src/lxml/lxml.etree.c:138273:81: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]  src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'  src/lxml/lxml.etree.c: In function '__pyx_f_4lxml_5etree__copyXSLT':  src/lxml/lxml.etree.c:139667:79: warning: passing argument 1 of '__pyx_f_4lxml_5etree_12_XSLTContext__copy' from incompatible pointer type [enabled by default]  src/lxml/lxml.etree.c:136229:52: note: expected 'struct __pyx_obj_4lxml_5etree__XSLTContext *' but argument is of type 'struct __pyx_obj_4lxml_5etree__BaseContext *'  src/lxml/lxml.etree.c: At top level:  src/lxml/lxml.etree.c:12384:13: warning: '__pyx_f_4lxml_5etree_displayNode' defined but not used [-Wunused-function]  gcc: internal compiler error: Killed (program cc1)  Please submit a full bug report,  with preprocessed source if appropriate.  See  for instructions.  error: command 'gcc' failed with exit status 4  ---------------------------------------- Command /home/admin/.virtualenvs/dev.actualito.com/bin/python -c "import setuptools;__file__='/home/admin/.virtualenvs/dev.actualito.com/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-asDtN5-record/install-record.txt --single-version-externally-managed --install-headers /home/admin/.virtualenvs/dev.actualito.com/include/site/python2.7 failed with error code 1 in /home/admin/.virtualenvs/dev.actualito.com/build/lxml Storing complete log in /home/admin/.pip/pip.log 
like image 429
Cristian Rojas Avatar asked Apr 22 '13 14:04

Cristian Rojas


People also ask

How do I import lxml into Python?

Type “ pip install lxml ” (without quotes) in the command line and hit Enter again. This installs lxml for your default Python installation. The previous command may not work if you have both Python versions 2 and 3 on your computer. In this case, try "pip3 install lxml" or “ python -m pip install lxml “.

How do I download lxml?

In case you want to use the current in-development version of lxml, you can get it from the github repository at https://github.com/lxml/lxml . Note that this requires Cython to build the sources, see the build instructions on the project home page.


1 Answers

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 
like image 147
Matmas Avatar answered Sep 21 '22 17:09

Matmas