title: Problems installing lxml in Ubuntu
body: <p>Getting the following errors when I do: <strong>pip install lxml</strong>  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>You are using pip version 6.0.8, however version 7.1.0 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.                                                                                          
  Collecting lxml
    Using cached lxml-3.4.4.tar.gz
      /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
        warnings.warn(msg)
      Building lxml version 3.4.4.
      Building without Cython.
      ERROR: /bin/sh: 1: xslt-config: not found
      ** make sure the development packages of libxml2 and libxslt are installed **
      Using build configuration of libxslt
  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.4.4.
      Building without Cython.
      ERROR: /bin/sh: 1: xslt-config: not found
      ** make sure the development packages of libxml2 and libxslt are installed **
      Using build configuration of libxslt
      building 'lxml.etree' extension
      i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-RLyvkw/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -w
      In file included from src/lxml/lxml.etree.c:239:0:
      /tmp/pip-build-RLyvkw/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
       #include "libxml/xmlversion.h"
                                     ^
      compilation terminated.
      error: command 'i686-linux-gnu-gcc' failed with exit status 1
      Complete output from command /home/apurva/.virtualenvs/universallogin/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-RLyvkw/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9WRQzF-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/apurva/.virtualenvs/universallogin/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.4.4.
      
      Building without Cython.
      
      ERROR: /bin/sh: 1: xslt-config: not found
      
      
      
      ** make sure the development packages of libxml2 and libxslt are installed **
      
      
      
      Using build configuration of libxslt
      
      running install
      
      running build
      
      running build_py
      
      creating build
      
      creating build/lib.linux-i686-2.7
      
      creating build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/pyclasslookup.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/doctestcompare.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/sax.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/_elementpath.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/__init__.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/builder.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/ElementInclude.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/cssselect.py -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/usedoctest.py -&gt; build/lib.linux-i686-2.7/lxml
      
      creating build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/__init__.py -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      creating build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/soupparser.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/html5parser.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/_setmixin.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/diff.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/formfill.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/_diffcommand.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/ElementSoup.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/__init__.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/builder.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/defs.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/_html5builder.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/usedoctest.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      copying src/lxml/html/clean.py -&gt; build/lib.linux-i686-2.7/lxml/html
      
      creating build/lib.linux-i686-2.7/lxml/isoschematron
      
      copying src/lxml/isoschematron/__init__.py -&gt; build/lib.linux-i686-2.7/lxml/isoschematron
      
      copying src/lxml/lxml.etree.h -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/lxml.etree_api.h -&gt; build/lib.linux-i686-2.7/lxml
      
      copying src/lxml/includes/htmlparser.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/xinclude.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/c14n.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/xpath.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/etreepublic.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/schematron.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/xslt.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/tree.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/config.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/xmlschema.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/xmlerror.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/xmlparser.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/dtdvalid.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/uri.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/relaxng.pxd -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/etree_defs.h -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      copying src/lxml/includes/lxml-version.h -&gt; build/lib.linux-i686-2.7/lxml/includes
      
      creating build/lib.linux-i686-2.7/lxml/isoschematron/resources
      
      creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/rng
      
      copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -&gt; build/lib.linux-i686-2.7/lxml/isoschematron/resources/rng
      
      creating build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
      
      copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -&gt; build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
      
      copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -&gt; build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl
      
      creating build/lib.linux-i686-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-i686-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-i686-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-i686-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-i686-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-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -&gt; build/lib.linux-i686-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      
      running build_ext
      
      building 'lxml.etree' extension
      
      creating build/temp.linux-i686-2.7
      
      creating build/temp.linux-i686-2.7/src
      
      creating build/temp.linux-i686-2.7/src/lxml
      
      i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-RLyvkw/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -w
      
      In file included from src/lxml/lxml.etree.c:239:0:
      
      /tmp/pip-build-RLyvkw/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
      
       #include "libxml/xmlversion.h"
      
                                     ^
      
      compilation terminated.
      
      error: command 'i686-linux-gnu-gcc' failed with exit status 1
      
      ----------------------------------------
      Command "/home/apurva/.virtualenvs/universallogin/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-RLyvkw/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9WRQzF-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/apurva/.virtualenvs/universallogin/include/site/python2.7" failed with error code 1 in /tmp/pip-build-RLyvkw/lxml</code></pre>
  </div>
  </div>
  </p>
  
  <p>I've already tried this: sudo apt-get install zlib1g-dev
  before "pip install" reading this answer: <a href="https://stackoverflow.com/questions/23570913/not-able-to-install-lxml-verison-3-3-5-in-ubuntu">Not able to install lxml verison 3.3.5 in ubuntu</a></p>
  
  <p>but did not help.
  Also, tried installing python-dev, python3-dev, lib-eventdev did not help either. </p>
  
  <p>Also, tried doing this: STATIC_DEPS=true pip install lxml 
  reading this: <a href="http://lxml.de/installation.html" rel="nofollow noreferrer">http://lxml.de/installation.html</a> </p>
  
  <p>Did not help either! 
  Will be very grateful if you could suggest something
  Thanks in advance.</p>