0

I'm trying to install lxml but having some difficulties:

[root@ip-xx-xxx-xx-113 init.d]# pip install lxml
Downloading/unpacking lxml
  Running setup.py egg_info for package lxml
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.3.0.beta2.
    Building without Cython.
    Using build configuration of libxslt 1.1.26
    Building against libxml2/libxslt in the following directory: /usr/lib64
    warning: no files found matching '*.py' under directory 'fake_pyrex'
Installing collected packages: lxml
  Running setup.py install for lxml
    /usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.3.0.beta2.
    Building without Cython.
    Using build configuration of libxslt 1.1.26
    Building against libxml2/libxslt in the following directory: /usr/lib64
    building 'lxml.etree' extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-root/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_4data’:
    src/lxml/lxml.etree.c:102248: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData’ from incompatible pointer type
    src/lxml/lxml.etree.c:101849: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_6start’:
    src/lxml/lxml.etree.c:102385: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart’ from incompatible pointer type
    src/lxml/lxml.etree.c:101549: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_8end’:
    src/lxml/lxml.etree.c:102443: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd’ from incompatible pointer type
    src/lxml/lxml.etree.c:101773: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_10pi’:
    src/lxml/lxml.etree.c:102601: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi’ from incompatible pointer type
    src/lxml/lxml.etree.c:101889: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_11TreeBuilder_12comment’:
    src/lxml/lxml.etree.c:102654: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment’ from incompatible pointer type
    src/lxml/lxml.etree.c:102015: note: expected ‘struct __pyx_obj_4lxml_5etree_TreeBuilder *’ but argument is of type ‘struct __pyx_obj_4lxml_5etree__SaxParserTarget *’
    src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree__xslt_resolve_from_python’:
    src/lxml/lxml.etree.c:137740: warning: enumeration value ‘__pyx_e_4lxml_5etree_PARSER_DATA_INVALID’ not handled in switch
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_4XSLT_18__call__’:
    src/lxml/lxml.etree.c:141814: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_12_XSLTContext__copy’ from incompatible pointer type
    src/lxml/lxml.etree.c:139749: 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:143212: warning: passing argument 1 of ‘__pyx_f_4lxml_5etree_12_XSLTContext__copy’ from incompatible pointer type
    src/lxml/lxml.etree.c:139749: 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:12826: warning: ‘__pyx_f_4lxml_5etree_displayNode’ defined but not used
    src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile’:
    src/lxml/lxml.etree.c:90304: warning: ‘__pyx_r’ may be used uninitialized in this function
    src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc’:
    src/lxml/lxml.etree.c:89619: warning: ‘__pyx_r’ may be used uninitialized in this function
    src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseDoc’:
    src/lxml/lxml.etree.c:89970: warning: ‘__pyx_r’ may be used uninitialized in this function
    src/lxml/lxml.etree.c: In function ‘__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike’:
    src/lxml/lxml.etree.c:90623: warning: ‘__pyx_r’ may be used uninitialized in this function

SO the output just hangs and nothing is installed.

Here is some information about machine:

[root@ip-xx-xxx-xx-113 ec2-user]# cat /proc/version
Linux version 2.6.32-431.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UTC 2013

[root@ip-xx-xxx-xx-113 ec2-user]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

[root@ip-xx-xxx-xx-113 ec2-user]# python --version
Python 2.6.6
Vor
  • 33,215
  • 43
  • 135
  • 193
  • 8
    Try this: `yum install libxslt-devel libxml2-devel`. Taken from http://stackoverflow.com/a/12896566/135157 – Jimothy Jan 02 '14 at 15:28
  • 1
    Possible duplicate of [pip install lxml error](http://stackoverflow.com/questions/5178416/pip-install-lxml-error) – Amir Ali Akbari Dec 11 '16 at 12:12

2 Answers2

4

Install these dependencies first

sudo yum install libxml2 libxml2-devel libxml2-python libxslt libxslt-devel

pip install lxml or easy_install lxml

It is advised to use virtual environment. It helps in isolating python environments.

Yogesh Yadav
  • 4,557
  • 6
  • 34
  • 40
3

Too low rep to comment. I had trouble installing lxml on Centos 7, but succeded using nairobi's answer in the post Jimothy linked to above. yum install libxslt-devel libxml2-devel

Hope This helps people who find this post in the future.

Community
  • 1
  • 1
user2213295
  • 121
  • 1
  • 7