Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install lxml fails #3793

Closed
ashishm9 opened this issue May 11, 2019 · 26 comments
Closed

pip install lxml fails #3793

ashishm9 opened this issue May 11, 2019 · 26 comments

Comments

@ashishm9
Copy link

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 <iconv.h>
^~~~~~~~~
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 <iconv.h>
^~~~~~~~~
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/

@ashishm9
Copy link
Author

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

@Grimler91
Copy link
Member

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.

@muxuezi
Copy link

muxuezi commented Jul 9, 2019

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

@a092devs
Copy link

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

@ghost
Copy link

ghost commented Sep 16, 2019

Install same packages but without -dev suffix.

@ye7iaserag
Copy link

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

@ghost
Copy link

ghost commented Sep 23, 2019

@ye7iaserag dev packages are not needed anymore.

pkg install libxml2 libxslt

is enough.

@ghost ghost deleted a comment from LuAXC Sep 30, 2019
@osamatech786
Copy link

osamatech786 commented Oct 7, 2019

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

@medram
Copy link

medram commented Oct 29, 2019

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 :-)

@mudirajesh
Copy link

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.

@mudirajesh
Copy link

Please help

@ghost
Copy link

ghost commented Apr 20, 2020

@RAJESHMUDI pkg install pkg-config

@mudirajesh
Copy link

mudirajesh commented Apr 20, 2020

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

Please help to install libxml2

@mudirajesh
Copy link

@RAJESHMUDI pkg install pkg-config

After that

@ghost
Copy link

ghost commented Apr 20, 2020

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

@ghost ghost deleted a comment from panglima-biru Apr 20, 2020
@bilal800
Copy link

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

@Nai-mul
Copy link

Nai-mul commented Jun 7, 2020

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

@ghost
Copy link

ghost commented Jun 7, 2020

Try to install it by
pkg install wheel

pip install wheel

@nisalup
Copy link

nisalup commented Jul 31, 2020

From the docs:

sudo apt-get install python3-lxml

This works nicely for aarch64 too.

@ghost
Copy link

ghost commented Jul 31, 2020

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.

@ignisc4t
Copy link

ignisc4t commented Aug 7, 2020

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.

@ghost
Copy link

ghost commented Aug 7, 2020

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.

@ignisc4t
Copy link

ignisc4t commented Aug 7, 2020

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 👍

@vrnDhmn
Copy link

vrnDhmn commented Sep 12, 2021

pip install wheel
pkg install libxml2 libxslt

thanks, I was stuck here for a day

In case one is running a virtual environment make sure to run these commands inside the venv bin directory

cd <venvName>/bin
pip install wheel
pkg install libxml2 libxslt

@NaveenTanguduTR
Copy link

NaveenTanguduTR commented Sep 27, 2021

while installing
1)pip install m3-libxml2-python getting below error

Looking in indexes: https://********:****@tr1.jfrog.io/tr1/api/pypi/pypi/simple
Collecting m3-libxml2-python
Using cached https://tr1.jfrog.io/tr1/api/pypi/pypi/packages/packages/73/39/a693515e3e8ef221498c2da975f76cc377d632ee7bb74b0028736963afc6/m3-libxml2-python-2.6.9.tar.gz (201 kB)

ERROR: Command errored out with exit status 1:
 command: 'C:\Users\*******\PycharmProjects\handson\venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\*******\\AppData\\Local\\Temp\\pip-install-ztksvhrz\\m3-libxml2-python_f044543e4ca140678bad250cf8feca47\\setup.py'"'"'; __file__='"'"'C:\\Users\\6110412\\AppData\\Local\\Temp\\pip-install-ztksvhrz\\m3-libxml2-python_f044543e4ca140678bad250cf8feca47\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\6110412\AppData\Local\Temp\pip-pip-egg-info-evb7zv8_'
     cwd: C:\Users\empid\AppData\Local\Temp\pip-install-ztksvhrz\m3-libxml2-python_f044543e4ca140678bad250cf8feca47\
Complete output (6 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\*******\AppData\Local\Temp\pip-install-ztksvhrz\m3-libxml2-python_f044543e4ca140678bad250cf8feca47\setup.py", line 70
    break;
         ^
TabError: inconsistent use of tabs and spaces in indentation
----------------------------------------

WARNING: Discarding https://tr1.jfrog.io/tr1/api/pypi/pypi/packages/packages/73/39/a693515e3e8ef221498c2da975f76cc377d632ee7bb74b0028736963afc6/m3-libxml2-python-2.6.9.tar.gz#sha256=7397cd24bbcbcd74a22d3e817d5f56510d07e823e41292efa6f56871fe0107b5 (from https://tr1.jfrog.io/tr1/api/pypi/pypi/simple/m3-libxml2-python/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement m3-libxml2-python (from versions: 2.6.9)
ERROR: No matching distribution found for m3-libxml2-python.

2)pip install libxml2-python

Looking in indexes: https://6110412:****@tr1.jfrog.io/tr1/api/pypi/pypi/simple

ERROR: Could not find a version that satisfies the requirement libxml2-python (from versions: none)
ERROR: No matching distribution found for libxml2-python.

3)pip install libxml2-python3

Looking in indexes: https://***:@tr1.jfrog.io/tr1/api/pypi/pypi/simple
Collecting libxml2-python3
Using cached https://tr1.jfrog.io/tr1/api/pypi/pypi/packages/packages/41/97/a2ecf6c5b291799dbd40b3d041d89b0ecdb1b43c8c2503e27991325851cd/libxml2-python3-2.9.5.tar.gz (216 kB)

ERROR: Command errored out with exit status 1:
 command: 'C:\Users\*******\PycharmProjects\handson\venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\*******\\AppData\\Local\\Temp\\pip-install-al39ikfz\\libxml2-python3_49a92dc4f1674927adaf10b6048d80a8\\setup.py'"'"'; __file__='"'"'C:\\Users\\6110412\\AppData\\Local\\Temp\\pip-install-al39ikfz\\libxml2-python3_49a92dc4f1674927adaf10b6048d80a8\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\6110412\AppData\Local\Temp\pip-pip-egg-info-g8z9r58s'
     cwd: C:\Users\*******\AppData\Local\Temp\pip-install-al39ikfz\libxml2-python3_49a92dc4f1674927adaf10b6048d80a8\
Complete output (1 lines):
failed to find headers for libxml2: update includes_dir
----------------------------------------

WARNING: Discarding https://tr1.jfrog.io/tr1/api/pypi/pypi/packages/packages/41/97/a2ecf6c5b291799dbd40b3d041d89b0ecdb1b43c8c2503e27991325851cd/libxml2-python3-2.9.5.tar.gz#sha256=51a6f863b639ce89cdfed32d58d9d37066301c373247f1c370b10d7edebe5e65 (from https://tr1.jfrog.io/tr1/api/pypi/pypi/simple/libxml2-python3/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement libxml2-python3 (from versions: 2.9.5)
ERROR: No matching distribution found for libxml2-python3

It would be grateful if anyone helps me.

@Grimler91
Copy link
Member

@NaveenTanguduTR seems like you are running on windows, so any installation issues are completely unrelated to the termux project

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests