title: lxml installation error ubuntu 14.04 (internal compiler error)
body: <p>I am having problems with installing <code>lxml</code>. I have tried the solutions of the relative questions in this site and other sites but could not fix the problem. Need some suggestions/solution on this.</p>
  
  <p>I am providing the full log after executing <code>pip install lxml</code>, </p>
  
  <pre><code>Downloading/unpacking lxml
    Downloading lxml-3.3.5.tar.gz (3.5MB): 3.5MB downloaded
    Running setup.py (path:/tmp/pip_build_root/lxml/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.3.5.
      Building without Cython.
      Using build configuration of libxslt 1.1.28
  
      warning: no previously-included files found matching '*.py'
  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.3.5.
      Building without Cython.
      Using build configuration of libxslt 1.1.28
      building 'lxml.etree' extension
      x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/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 -w
      x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
      Please submit a full bug report,
      with preprocessed source if appropriate.
      See &lt;file:///usr/share/doc/gcc-4.8/README.Bugs&gt; for instructions.
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
      Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KUq9VD-record/install-record.txt --single-version-externally-managed --compile:
      /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
  
    warnings.warn(msg)
  
  Building lxml version 3.3.5.
  
  Building without Cython.
  
  Using build configuration of libxslt 1.1.28
  
  running install
  
  running build
  
  running build_py
  
  creating build
  
  creating build/lib.linux-x86_64-2.7
  
  creating build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/pyclasslookup.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/doctestcompare.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/builder.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/cssselect.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/sax.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/_elementpath.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/ElementInclude.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/__init__.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/usedoctest.py -&gt; build/lib.linux-x86_64-2.7/lxml
  
  creating build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/__init__.py -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  creating build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/html5parser.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/ElementSoup.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/builder.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/clean.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/_diffcommand.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/diff.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/_html5builder.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/_setmixin.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/defs.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/formfill.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/soupparser.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/__init__.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  copying src/lxml/html/usedoctest.py -&gt; build/lib.linux-x86_64-2.7/lxml/html
  
  creating build/lib.linux-x86_64-2.7/lxml/isoschematron
  
  copying src/lxml/isoschematron/__init__.py -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron
  
  copying src/lxml/lxml.etree.h -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/lxml.etree_api.h -&gt; build/lib.linux-x86_64-2.7/lxml
  
  copying src/lxml/includes/config.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/xpath.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/tree.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/dtdvalid.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/xmlparser.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/etreepublic.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/xslt.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/schematron.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/uri.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/c14n.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/xinclude.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/xmlschema.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/xmlerror.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/relaxng.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/htmlparser.pxd -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/etree_defs.h -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  copying src/lxml/includes/lxml-version.h -&gt; build/lib.linux-x86_64-2.7/lxml/includes
  
  creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources
  
  creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/rng
  
  copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/rng
  
  creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
  
  copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
  
  copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
  
  creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -&gt; build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  
  running build_ext
  
  building 'lxml.etree' extension
  
  creating build/temp.linux-x86_64-2.7
  
  creating build/temp.linux-x86_64-2.7/src
  
  creating build/temp.linux-x86_64-2.7/src/lxml
  
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/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 -w
  
  x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
  
  Please submit a full bug report,
  
  with preprocessed source if appropriate.
  
  See &lt;file:///usr/share/doc/gcc-4.8/README.Bugs&gt; for instructions.
  
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
  
  ----------------------------------------
  Cleaning up...
  Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KUq9VD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
  Storing debug log for failure in /root/.pip/pip.log
  </code></pre>
  
  <p>Also, the <code>pip.log</code> file looks like this,</p>
  
  <pre><code>status = self.run(options, args)
    File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
      requirement_set.install(install_options, global_options, root=options.root_path)
    File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install
      requirement.install(install_options, global_options, *args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/pip/req.py", line 706, in install
      cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
    File "/usr/lib/python2.7/dist-packages/pip/util.py", line 697, in call_subprocess
      % (command_desc, proc.returncode, cwd))
  InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KUq9VD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
  </code></pre>
  
  <p><code>dmesg | tail</code> command shows output like this,</p>
  
  <pre><code>[1744367.676147] Out of memory: Kill process 25518 (cc1) score 388 or sacrifice child
  [1744367.676665] Killed process 25518 (cc1) total-vm:242352kB, anon-rss:200608kB, file-rss:0kB
  </code></pre>
  
  <p>It's seems like a memory issue. I am taking reference form <a href="https://stackoverflow.com/questions/16149613/installing-lxml-with-pip-in-virtualenv-ubuntu-12-10-error-command-gcc-failed">this question</a></p>