Termux-packages: pip install lxml fails

Created on 11 May 2019  路  23Comments  路  Source: termux/termux-packages

pip install lxml fails with the following error:-

running setup.py install for lxml ... error
ERROR: Complete output from command /data/data/com.termux/files/usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-fe2wm8xs/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /data/data/com.termux/files/usr/tmp/pip-record-y296du61/install-record.txt --single-version-externally-managed --compile:
ERROR: Building lxml version 4.3.3.
Building without Cython.
Using build configuration of libxslt 1.1.33
Building against libxml2/libxslt in the following directory: /data/data/com.termux/files/usr/lib
running install
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.7
creating build/lib.linux-aarch64-3.7/lxml
copying src/lxml/sax.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/__init__.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/cssselect.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/builder.py -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-aarch64-3.7/lxml
creating build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-aarch64-3.7/lxml/includes
creating build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-aarch64-3.7/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-aarch64-3.7/lxml/html
creating build/lib.linux-aarch64-3.7/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-aarch64-3.7/lxml/isoschematron
copying src/lxml/etree.h -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/etree_api.h -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/lxml.etree.h -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-aarch64-3.7/lxml
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/__init__.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-aarch64-3.7/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-aarch64-3.7/lxml/includes
creating build/lib.linux-aarch64-3.7/lxml/isoschematron/resources
creating build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/rng
creating build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl
creating build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-aarch64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-aarch64-3.7
creating build/temp.linux-aarch64-3.7/src
creating build/temp.linux-aarch64-3.7/src/lxml
aarch64-linux-android-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Oz -Oz -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/data/data/com.termux/files/usr/include/python3.7m -c src/lxml/etree.c -o build/temp.linux-aarch64-3.7/src/lxml/etree.o -w
In file included from src/lxml/etree.c:687:
In file included from src/lxml/includes/etree_defs.h:186:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/tree.h:1307:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/xmlmemory.h:218:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/threads.h:35:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/globals.h:18:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/parser.h:810:
/data/data/com.termux/files/usr/include/libxml2/libxml/encoding.h:28:10: fatal error: 'iconv.h' file not found
#include
^~~
1 error generated.
Compile failed: command 'aarch64-linux-android-clang' failed with exit status 1
creating data
creating data/data
creating data/data/com.termux
creating data/data/com.termux/files
creating data/data/com.termux/files/usr
creating data/data/com.termux/files/usr/tmp
cc -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/usr/include/libxml2 -I/usr/include/libxml2 -c /data/data/com.termux/files/usr/tmp/xmlXPathInitmcb084gu.c -o data/data/com.termux/files/usr/tmp/xmlXPathInitmcb084gu.o
In file included from /data/data/com.termux/files/usr/tmp/xmlXPathInitmcb084gu.c:1:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/xpath.h:26:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/xmlerror.h:10:
In file included from /data/data/com.termux/files/usr/include/libxml2/libxml/parser.h:810:
/data/data/com.termux/files/usr/include/libxml2/libxml/encoding.h:28:10: fatal error: 'iconv.h' file not found
#include
^
~~
1 error generated.
**************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
**************************
error: command 'aarch64-linux-android-clang' failed with exit status 1
----------------------------------------
ERROR: Command "/data/data/com.termux/files/usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-fe2wm8xs/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /data/data/com.termux/files/usr/tmp/pip-record-y296du61/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /data/data/com.termux/files/usr/tmp/pip-install-fe2wm8xs/lxml/

Most helpful comment

@ye7iaserag dev packages are not needed anymore.

pkg install libxml2 libxslt

is enough.

All 23 comments

I have already installed clang, libxml2, libxml2-dev, libxslt & libxslt-dev.
Output of termux-info:
termux-info
Updatable packages:
All packages up to date
Subscribed repositories:
https://dl.bintray.com/grimler/science-packages-24 science/stable
https://dl.bintray.com/grimler/game-packages-24 games/stable
https://dl.bintray.com/termux/termux-packages-24 stable/main
System information:
Linux localhost 4.4.153-perf+ #1 SMP PREEMPT Thu Apr 11 11:14:12 WIB 2019 aarch64 Android
Termux-packages arch:
aarch64
Android version:
9
Device manufacturer:
Xiaomi
Device model:
Mi A2

iconv.h is found in libiconv-dev.

If you get an error that a file is missing then googling for that file can probably tell you which package to install.

iconv.h is found in libiconv-dev.

If you get an error that a file is missing then googling for that file can probably tell you which package to install.

I use this,

pkg install libxml2-dev libxslt-dev libiconv-dev

I faced the same issue! the dev packages are not working now, how do I install lxml?

Install same packages but without -dev suffix.

I'm facing the same issue, all the dev packages are gone, the none dev ones are all installed

@ye7iaserag dev packages are not needed anymore.

pkg install libxml2 libxslt

is enough.

@xeffyr
Thanks a lot, it solved my problem
I use these
pip install wheel
pkg install libxml2 libxslt

thanks a lot,
I solved this problem using
pkg install clang
pkg install libxml2 libxslt
pip install cython
pip install lxml
have a good day :-)

Already i installed all packages like
pkg install libxml2
pkg install wheel
pkg install cython
pkg install clang
pkg install libxslt
pip install lxml

Same issue are arrived :
Execution error:

The Python library libxml2 is not installed in your system.

Because of that, some plugins aren't going to work correctly.

Please, install it before use this application.

Please help

@RAJESHMUDI pkg install pkg-config

Screenshot_2020-04-19-01-24-52-330_com termux

Please help to install libxml2

@RAJESHMUDI pkg install pkg-config

After that

findmyhash requires python bindings for libxml2 which we do not provide.

Screenshot_2020-05-11-12-22-51-75
Please help

Screenshot_2020-05-11-12-22-51-75
Please help

Do you see that wheel is not installed
Try to install it by
pkg install wheel

Try to install it by
pkg install wheel

pip install wheel

From the docs:

sudo apt-get install python3-lxml

This works nicely for aarch64 too.

sudo apt-get install python3-lxml

Termux does not provide python3-lxml package and it should be installed with pip. Also apt should not be used as root and is patched against this anyway.

for me :

pkg install libxml2 libxslt
pip install lxml # if this one fail or taking too long at wheel, use:
CFLAGS="-O0" pip install lxml

these command work flawlesly on me :D thanks for the comment up there from 2019, and some guide on lxml[dot]de page.
I was reinstalling my phone, so I need to get it back to work like yesterday ;)

edit:
what is the different between libxml2 and libxml2-utils ? anyone ? shoul I install it or just use the normal libxml2 ?

  • not a programmer, just user.

what is the different between libxml2 and libxml2-utils ?

libxml2 is a library, libxml2-utils is a split-off from libxml2 package, a set of utilities for working with xml.

what is the different between libxml2 and libxml2-utils ?

libxml2 is a library, libxml2-utils is a split-off from libxml2 package, a set of utilities for working with xml.

ah I see, so I'm just stay with standard libxml2 then. anyway, keep the good work dev, don't forget to enjoy your coffee 馃憤

Was this page helpful?
0 / 5 - 0 ratings