'pip install matplotlib on termux failed
I am trying to install matplolib on android device using termux, but have been failing.
I have installed libjpeg-turbo and zlib, and tried installing other packages libtiff, libwebp, openjpeg, and so on.
But it is still failing.(Error message has been changed though)
anyone solved this problem?
Part of the error message below.
(the entire message is to long)
building 'PIL._imagingmorph' extension
aarch64-linux-android-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC -I/data/data/com.termux/files/usr/include/freetype2 -I/data/data/com.termux/files/usr/include/openjpeg-2.4 -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/usr/include/fribidi -I/data/data/com.termux/files/usr/include/python3.10 -c src/_imagingmorph.c -o build/temp.linux-aarch64-3.10/src/_imagingmorph.o aarch64-linux-android-clang -shared -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -landroid-support -L/home/builder/.termux-build/_cache/android-r23b-api-24-v4/sysroot/usr/lib -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -landroid-support -L/home/builder/.termux-build/_cache/android-r23b-api-24-v4/sysroot/usr/lib build/temp.linux-aarch64-3.10/src/_imagingmorph.o -L/data/data/com.termux/files/usr/lib -L/system/lib -L/data/data/com.termux/files/usr/lib -lpython3.10 -o build/lib.linux-aarch64-3.10/PIL/_imagingmorph.cpython-310.so
ld.lld: error: /system/lib/libdl.so is incompatible with aarch64linux ld.lld: error: /system/lib/libc.so is incompatible with aarch64linux
ld.lld: error: /system/lib/libdl.so is incompatible with aarch64linux clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/data/data/com.termux/files/usr/bin/aarch64-linux-android-clang' failed with exit code 1 ----------------------------------------
ERROR: Command errored out with exit status 1: /data/data/com.termux/files/usr/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-ph9ufjl1/pillow_dc19fcb286984db9872b8b4c61d3d8d9/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-ph9ufjl1/pillow_dc19fcb286984db9872b8b4c61d3d8d9/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'"'"'))' install --record /data/data/com.termux/files/usr/tmp/pip-record-z4n90t_6/install-record.txt --single-version-externally-managed --compile --install-headers /data/data/com.termux/files/usr/include/python3.10/pillow Check the logs for full command output.
Solution 1:[1]
I'm not sure if it will help, but I personaly could not install Pillow and some other libraries on my termux without this (flags?):
LDFLAGS="-L/system/lib64/" CFLAGS="-I/data/data/com.termux/files/usr/include/" pip install matplotlib
It's probably an error that has to do with our phones using the "AArch64" ARM architecture.
Solution 2:[2]
Termux's package manager contains the matplotlib package.
So you can install matplotlib via
pkg install matplotlib
and after that matplotlib can be imported in the Python version (3.10.4 as of 2022/04/09) even one fails to configure pip to install matplotlib.
(You can see the actual dependencies by pkg show matplotlib.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RĂ´mulo Saraiva |
| Solution 2 | TWY |
