pip install matplotlib on termux failed - matplotlib

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.

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

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.

Related

Getting Python.h: No such file or directory when compiling mod_wsgi on OSX with python3

I have updated the python code from Python2 to Python3. I had no issues compiling mod_wsgi with python2. But When I compile it with Python3, it's giving below error.
I tried to get rid of the mod_wsgi installed at OS level and tried pointing the ./configure script to different Python3 locations. But, nothing worked.
./configure -with-python=/usr/bin/python3
make
[user#xx-xx-xx-xx mod_wsgi-4.6.4]$ make
/usr/bin/apxs -c -I/usr/include/python3.7m -DNDEBUG -D_GNU_SOURCE -Wc,-g -Wc,-O2 src/server/mod_wsgi.c src/server/wsgi_*.c -L/usr/lib64 -L/usr/lib64/python3.7/config-3.7m -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -g -O2 -I/usr/include/python3.7m -DNDEBUG -D_GNU_SOURCE -c -o src/server/mod_wsgi.lo src/server/mod_wsgi.c && touch src/server/mod_wsgi.slo
In file included from src/server/mod_wsgi.c:22:0:
src/server/wsgi_python.h:24:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
apxs:Error: Command failed with rc=65536
The solution to this problem depends on your Linux distribution. You'll have to install the dev package for your Python version.
sudo apt-get install python3-dev
sudo yum install python3-devel
A more complete explanation on the missing Python header file can be found here

Installation errors during installation of spaCy on Mac

enter code hereerror: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;file='/private/var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-build-g2pxxnlc/murmurhash/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-wjdy1tf5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-build-g2pxxnlc/murmurhash/
enter code hereFailed building wheel for regex
Running setup.py clean for regex
Failed to build regex
Installing collected packages: html5lib, pathlib, regex, msgpack-python, tqdm, toolz
Found existing installation: html5lib 0.999999999
Uninstalling html5lib-0.999999999:
Successfully uninstalled html5lib-0.999999999
Found existing installation: regex 2017.11.9
Uninstalling regex-2017.11.9:
Successfully uninstalled regex-2017.11.9
Running setup.py install for regex ... error
Complete output from command /Users/venkateshpala/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-build-ltar9s28/regex/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-edv9r7il-record/install-record.txt --single-version-externally-managed --compile:
/Users/venkateshpala/anaconda3/lib/python3.6/site-packages/setuptools/dist.py:351: UserWarning: Normalizing '2017.04.05' to '2017.4.5'
normalized_version,
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.6
copying Python3/regex.py -> build/lib.macosx-10.7-x86_64-3.6
copying Python3/_regex_core.py -> build/lib.macosx-10.7-x86_64-3.6
copying Python3/test_regex.py -> build/lib.macosx-10.7-x86_64-3.6
running build_ext
building '_regex' extension
creating build/temp.macosx-10.7-x86_64-3.6
creating build/temp.macosx-10.7-x86_64-3.6/Python3
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/venkateshpala/anaconda3/include -arch x86_64 -I/Users/venkateshpala/anaconda3/include -arch x86_64 -I/Users/venkateshpala/anaconda3/include/python3.6m -c Python3/_regex.c -o build/temp.macosx-10.7-x86_64-3.6/Python3/_regex.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of regex
Command "/Users/venkateshpala/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-build-ltar9s28/regex/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-edv9r7il-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hl/zm3tpkmd4ws1b21nk792wdj80000gn/T/pip-build-ltar9s28/regex/
The thing is there are some libraries that we(macOs users) can't install unless there is Xcode installed or binaries of Xcode is what I was asked for during the time of Installation after which I was able to download and run the spaCy on my Machine.
in your log:
command 'gcc' failed with exit status 1
Installing gcc might fix the error, or another compatible compiler symlinked to gcc.

undeclared identifier when trying to install libsodium-php on ubuntu 16.04

I'm having some trouble installing the php wrapper for libsodium on Ubuntu 16.04. I installed libsodium with sudo apt-get install libsodium but when I run sudo pecl install libsodium I get a undeclared identifier error.
running: make
/bin/bash /tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/libtool --mode=compile cc -I. -I/tmp/pear/temp/libsodium -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/include -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/main -I/tmp/pear/temp/libsodium -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/libsodium/libsodium.c -o libsodium.lo
libtool: compile: cc -I. -I/tmp/pear/temp/libsodium -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/include -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/main -I/tmp/pear/temp/libsodium -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/libsodium/libsodium.c -fPIC -DPIC -o .libs/libsodium.o
/tmp/pear/temp/libsodium/libsodium.c: In function ‘zif_sodium_crypto_kdf_derive_from_key’:
/tmp/pear/temp/libsodium/libsodium.c:2899:29: error: ‘crypto_kdf_blake2b_CONTEXTBYTES’ undeclared (first use in this function)
memcpy(ctx_padded, ctx, crypto_kdf_blake2b_CONTEXTBYTES);
^
/tmp/pear/temp/libsodium/libsodium.c:2899:29: note: each undeclared identifier is reported only once for each function it appears in
Makefile:194: recipe for target 'libsodium.lo' failed
make: *** [libsodium.lo] Error 1
ERROR: `make' failed
It looks like apt-get wasn't installing the latest version of libsodium. After downloading and compiling the latest version I was able to install the php extension.

unable to `pip install numpy` on a specific machine

pip install numpy in a python virtualenv on my own Mac OSX machine and on another of my machine running Arch Linux works perfectly.
Unfortunately, the same command fails to work on a colleague's machine running Gentoo.
Here's the pip.log showing the error logs:-
building data_files sources
build_src: building npy-pkg config files
running build_py
copying numpy/version.py -> build/lib.linux-x86_64-2.7/numpy
copying build/src.linux-x86_64-2.7/numpy/__config__.py -> build/lib.linux-x86_64-2.7/numpy
copying build/src.linux-x86_64-2.7/numpy/distutils/__config__.py -> build/lib.linux-x86_64-2.7/numpy/distutils
running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize GnuFCompiler
customize IntelFCompiler
customize LaheyFCompiler
customize PGroupFCompiler
customize AbsoftFCompiler
customize NAGFCompiler
customize VastFCompiler
customize CompaqFCompiler
customize IntelItaniumFCompiler
customize IntelEM64TFCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'numpy.linalg.lapack_lite' extension
compiling C sources
C compiler: x86_64-pc-linux-gnu-gcc -pthread -O3 -march=native -pipe -fomit-frame-pointer -fno-ident -fPIC
compile options: '-DNO_ATLAS_INFO=1 -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c'
x86_64-pc-linux-gnu-gcc: numpy/linalg/lapack_litemodule.c
x86_64-pc-linux-gnu-gcc: numpy/linalg/python_xerbla.c
/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so" failed with exit status 1
----------------------------------------
Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy
Exception information:
Traceback (most recent call last):
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 250, in run
requirement_set.install(install_options, global_options)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1133, in install
requirement.install(install_options, global_options)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 577, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 256, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy
It appears that the gfortran on my colleague's machine does not play well with the numpy package he is trying to install in the virtualenv. Any idea why this might be so?
If CFLAGS, CXXFLAGS, or LDFLAGS are set, it could cause this. The problem is that those environment variables override the settings in the compile script, causing problems.
Just unset them for the invocation of the pip command and you should be all set.
It looks to me that setuptools is not working correctly, setuptools has been superceded by the python "dist" utility so you might want to install that and retry the installation.

Error when installing Twisted using PIP

4.11 and I'm trying to install Scrapy using either pip or easy_install.
It keeps failing for both, first it failed saying i didnt have gcc-4.0 available, then i used my install cd to install it. Now its popping up with other error(s).
Running setup.py install for Twisted, I receive the following errors in the beginning
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c conftest.c -o conftest.o
conftest.c:1:21: error: rpc/rpc.h: No such file or directory
conftest.c:1:21: error: rpc/rpc.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccXYV9xx.out
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c conftest.c -o conftest.o
conftest.c:1:23: error: sys/epoll.h: No such file or directory
conftest.c:1:23: error: sys/epoll.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//cctYFimU.out
building 'twisted.test.raiser' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c twisted/test/raiser.c -o build/temp.macosx-10.3-fat-2.7/twisted/test/raiser.o
and ends with:
lipo: can't figure out the architecture type of: /var/tmp//ccYXFDmd.out
error: command 'gcc-4.0' failed with exit status 1
I'm new to this all and any help to solve this would be great!
Are you on OS X?
Try this:
sudo env ARCHFLAGS="-arch i386 -arch x86_64" pip install scrapy
Related: trying to install lxml on max osx leopard