termux-packages
termux-packages copied to clipboard
[Bug]: Unable to install python module numpy in termux
Problem description
i was trying to install numpy with "pip install numpy" but it throws an error shown below
raise SystemError("One of the required function to build numpy is not" SystemError: One of the required function to build numpy is not available (the list is ['sin', 'cos', 'tan', 'sinh', 'cosh', 'tanh', 'fabs', 'floor', 'ceil', 'sqrt', 'log10', 'log', 'exp', 'asin', 'acos', 'atan', 'fmod', 'modf', 'frexp', 'ldexp']). [end of output]
Full error:- https://paste-bin.xyz/60090
Python version:- 3.10.4 pip version:- 22.1.1
Please help me to solve this error.
Thanks in advance
What steps will reproduce the bug?
I don't know. Actually i am an beginner
What is the expected behavior?
Numpy is installed
System information
termux-info: Termux Variables: TERMUX_API_VERSION=0.50.1 TERMUX_APK_RELEASE=F_DROID TERMUX_APP_PACKAGE_MANAGER=apt TERMUX_APP_PID=28976 TERMUX_IS_DEBUGGABLE_BUILD=0 TERMUX_MAIN_PACKAGE_FORMAT=debian TERMUX_VERSION=0.118.0 Packages CPU architecture: aarch64 Subscribed repositories:
sources.list
deb https://termux.astra.in.ua/apt/termux-main/ stable main Updatable packages: termux-tools/stable 0.181 all [upgradable from: 0.180] termux-tools version: 0.180 Android version: 11 Kernel build information: Linux localhost 4.14.186+ #1 SMP PREEMPT Mon Apr 25 00:51:13 CST 2022 aarch64 Android Device manufacturer: OnePlus Device model: IV2201
I can reproduce the issue. It doesn't link against libm for some reason and therefore doesn't find the math functions.
Best guess is that it started with https://github.com/numpy/numpy/commit/f2119f95b505b31cdfbf66e431544036238c8c68, maybe checking for log
instead of exp
doesn't work as a math test on android. (I can't seem to reproduce the test with neither log or exp though when I try, it compiles and runs fine with or without -lm
. Maybe I'm missing some compiler flags)
Installing numpy with
MATHLIB="m" pip3 install numpy
works as a workaround.
Thanks for your help. numpy is installed so closing this issue
I can reproduce the issue. It doesn't link against libm for some reason and therefore doesn't find the math functions.
Best guess is that it started with numpy/numpy@f2119f9, maybe checking for
log
instead ofexp
doesn't work as a math test on android. (I can't seem to reproduce the test with neither log or exp though when I try, it compiles and runs fine with or without-lm
. Maybe I'm missing some compiler flags)Installing numpy with
MATHLIB="m" pip3 install numpy
works as a workaround.
The installation method of numpy in https://wiki.termux.com/wiki/python needs to be modified to prevent users from opening the same issue again.
The installation method of numpy in https://wiki.termux.com/wiki/python needs to be modified
Updated, thanks
This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Now we have python-numpy
package. You can use it in case if it fails to install through pip
.
It's working.Thanks 👍
Now we have
python-numpy
package. You can use it in case if it fails to install throughpip
.
Why isn't this information easier to find from the source? My god i spent forever trying to find this solution.
Hi, I have the same issue but with spacy [subprocess-exited-with-error] [note: This error originates from a subprocess, and is likely not a problem with pip.]
Please help me to fix it!
Termux says failed to build wheels for blis and many others.
As noted above, due to complications in building numpy for Termux it has been given it's own package, which can be installed using pkg i python-numpy
@TomJo2000 Great jobs. How about pandas? I try command below, but not work...
export CFLAGS="-Wno-deprecated-declarations -Wno-unreachable-code"
pip install pandas
Make sure you have the TUR enabled.
pkg i tur-repo
Then.
pkg i python-pandas
Rephrasing my question:
I've done
pkg i tur-repo
pkg i python-numpy
Both these commands succeeded.
When I do
pkg i python-pandas
It complains about failing to build numpy again. What actually happens when you run pkg i python-numpy? Could this be because I'm in a venv?
Ok, I figured it out, it was in fact because I was in a venv. I just deleted my old venv and made a new one that inherited system site-packages:
deactivate
rm -rf venv
pip show numpy # should see the numpy installed with pkg
python -m venv --system-site-packages venv
source ./venv/bin/activate
pip show numpy # should see it again
I face an error with spacy installation (particularly blis), though numpy is already installed. Error is too big for terminal: https://hastebin.skyra.pw/iroqesuxis.rust
Where does pkg install python-numpy
actually save numpy? Pip doesn't see it with pip show numpy
for me. It would be nice to know how the python-*
packages work for reference.
Where does
pkg install python-numpy
actually save numpy? Pip doesn't see it withpip show numpy
for me. It would be nice to know how thepython-*
packages work for reference.
pkg reinstall python-numpy pip show numpy Name: numpy Version: 1.25.1 ... Location: /data/data/com.termux/files/usr/lib/python3.11/site-packages
Location: /data/data/com.termux/files/usr/lib/python3.11/site-packages
It did install there, but it seems like pip
, pip3
and pip3.11
were all linked to python 3.9
after I had installed 3.9 from the user repo, hence why it couldn't find the module 🙈.
Thanks for the response.
i guess this is still a thing i to am having problems with numpy iv tried everything iv seen on this issue to no avail specifically:
pip install transformers petals gtts speechrecognition torch
Collecting beniget~=0.4.0 (from pythran<0.14.0,>=0.12.0)
Downloading beniget-0.4.1-py3-none-any.whl (9.4 kB)
Collecting packaging>=19.0 (from pyproject-metadata>=0.7.1->meson-python<0.14.0,>=0.12.1)
Using cached packaging-23.1-py3-none-any.whl (48 kB)
Downloading meson_python-0.13.2-py3-none-any.whl (79 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 876.4 kB/s eta 0:00:00
Using cached Cython-0.29.36-py2.py3-none-any.whl (988 kB)
Downloading meson-1.2.1-py3-none-any.whl (962 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 962.5/962.5 kB 866.5 kB/s eta 0:00:00
Building wheels for collected packages: numpy
Building wheel for numpy (pyproject.toml): started
Building wheel for numpy (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for numpy (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [212 lines of output]
setup.py:71: RuntimeWarning: NumPy 1.23.2 may not yet support Python 3.11.
warnings.warn(
Running from numpy source directory.
setup.py:86: DeprecationWarning:
`numpy.distutils` is deprecated since NumPy 1.23.0, as a result
of the deprecation of `distutils` itself. It will be removed for
Python >= 3.12. For older Python versions it will remain present.
It is recommended to use `setuptools < 60.0` for those Python versions.
For more details, see:
https://numpy.org/devdocs/reference/distutils_status_migration.html
import numpy.distutils.command.sdist
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_common.pyx
Processing numpy/random/_generator.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/_pcg64.pyx
Processing numpy/random/_philox.pyx
Processing numpy/random/_sfc64.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Cythonizing sources
INFO: blas_opt_info:
INFO: blas_armpl_info:
INFO: customize UnixCCompiler
INFO: libraries armpl_lp64_mp not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: blas_mkl_info:
INFO: libraries mkl_rt not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: blis_info:
INFO: libraries blis not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: openblas_info:
INFO: C compiler: aarch64-linux-android-clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC
creating /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data
creating /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data/data
creating /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data/data/com.termux
creating /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data/data/com.termux/files
creating /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data/data/com.termux/files/usr
creating /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data/data/com.termux/files/usr/tmp
creating /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data/data/com.termux/files/usr/tmp/tmpze8th5_x
INFO: compile options: '-c'
INFO: aarch64-linux-android-clang: /data/data/com.termux/files/usr/tmp/tmpze8th5_x/source.c
INFO: aarch64-linux-android-clang /data/data/com.termux/files/usr/tmp/tmpze8th5_x/data/data/com.termux/files/usr/tmp/tmpze8th5_x/source.o -L/data/data/com.termux/files/usr/lib -lopenblas -o /data/data/com.termux/files/usr/tmp/tmpze8th5_x/a.out
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
non-existing path in 'numpy/distutils': 'site.cfg'
INFO: lapack_opt_info:
INFO: lapack_armpl_info:
INFO: libraries armpl_lp64_mp not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: lapack_mkl_info:
INFO: libraries mkl_rt not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: openblas_lapack_info:
INFO: C compiler: aarch64-linux-android-clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC
creating /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data
creating /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data/data
creating /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data/data/com.termux
creating /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data/data/com.termux/files
creating /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data/data/com.termux/files/usr
creating /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data/data/com.termux/files/usr/tmp
creating /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data/data/com.termux/files/usr/tmp/tmpt86ku5_y
INFO: compile options: '-c'
INFO: aarch64-linux-android-clang: /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/source.c
INFO: aarch64-linux-android-clang /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/data/data/com.termux/files/usr/tmp/tmpt86ku5_y/source.o -L/data/data/com.termux/files/usr/lib -lopenblas -o /data/data/com.termux/files/usr/tmp/tmpt86ku5_y/a.out
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
Warning: attempted relative import with no known parent package
/data/data/com.termux/files/usr/lib/python3.11/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running bdist_wheel
running build
running config_cc
INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
INFO: build_src
INFO: building py_modules sources
creating build
creating build/src.linux-aarch64-3.11
creating build/src.linux-aarch64-3.11/numpy
creating build/src.linux-aarch64-3.11/numpy/distutils
INFO: building library "npymath" sources
WARN: Could not locate executable armflang
WARN: Could not locate executable gfortran
WARN: Could not locate executable f95
WARN: Could not locate executable ifort
WARN: Could not locate executable ifc
WARN: Could not locate executable lf95
WARN: Could not locate executable pgfortran
WARN: Could not locate executable nvfortran
WARN: Could not locate executable f90
WARN: Could not locate executable f77
WARN: Could not locate executable fort
WARN: Could not locate executable efort
WARN: Could not locate executable efc
WARN: Could not locate executable g77
WARN: Could not locate executable g95
WARN: Could not locate executable pathf95
WARN: Could not locate executable nagfor
WARN: Could not locate executable frt
WARN: don't know how to compile Fortran code on platform 'posix'
creating build/src.linux-aarch64-3.11/numpy/core
creating build/src.linux-aarch64-3.11/numpy/core/src
creating build/src.linux-aarch64-3.11/numpy/core/src/npymath
INFO: conv_template:> build/src.linux-aarch64-3.11/numpy/core/src/npymath/npy_math_internal.h
INFO: adding 'build/src.linux-aarch64-3.11/numpy/core/src/npymath' to include_dirs.
INFO: conv_template:> build/src.linux-aarch64-3.11/numpy/core/src/npymath/ieee754.c
INFO: conv_template:> build/src.linux-aarch64-3.11/numpy/core/src/npymath/npy_math_complex.c
INFO: None - nothing done with h_files = ['build/src.linux-aarch64-3.11/numpy/core/src/npymath/npy_math_internal.h']
INFO: building library "npyrandom" sources
INFO: building extension "numpy.core._multiarray_tests" sources
creating build/src.linux-aarch64-3.11/numpy/core/src/multiarray
INFO: conv_template:> build/src.linux-aarch64-3.11/numpy/core/src/multiarray/_multiarray_tests.c
INFO: building extension "numpy.core._multiarray_umath" sources
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-3bp4igfh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 230, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-3bp4igfh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
self.run_setup()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-3bp4igfh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 268, in run_setup
self).run_setup(setup_script=setup_script)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-3bp4igfh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 493, in <module>
setup_package()
File "setup.py", line 485, in setup_package
setup(**metadata)
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-3bp4igfh/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/core.py", line 148, in setup
dist.run_commands()
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-3bp4igfh/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/distutils/command/build.py", line 62, in run
old_build.run(self)
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/data/data/com.termux/files/usr/lib/python3.11/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/distutils/command/build_src.py", line 144, in run
self.build_sources()
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/distutils/command/build_src.py", line 161, in build_sources
self.build_extension_sources(ext)
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/distutils/command/build_src.py", line 318, in build_extension_sources
sources = self.generate_sources(sources, ext)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/distutils/command/build_src.py", line 378, in generate_sources
source = func(extension, build_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/core/setup.py", line 513, in generate_config_h
check_math_capabilities(config_cmd, ext, moredefs, mathlibs)
File "/data/data/com.termux/files/usr/tmp/pip-install-47swtqcf/numpy_183268fd5f964c5a91ffca0c11c0851b/numpy/core/setup.py", line 176, in check_math_capabilities
raise SystemError("One of the required function to build numpy is not"
SystemError: One of the required function to build numpy is not available (the list is ['sin', 'cos', 'tan', 'sinh', 'cosh', 'tanh', 'fabs', 'floor', 'ceil', 'sqrt', 'log10', 'log', 'exp', 'asin', 'acos', 'atan', 'fmod', 'modf', 'frexp', 'ldexp']).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. ```
And how can i install the python-numpy package for python3.9? EDIT: use tur-repo
This issue should not be closed as the issue is still existing!
@patham9 It will exist indefinitely due to Termux nature. However since it is not really a bug, it would be closed.
It can be easily workarounded by passing necessary build flags when running pip install
.
Installation of numpy module:
pkg install python build-essential cmake ninja libopenblas libandroid-execinfo
pip3 install setuptools wheel packaging pyproject_metadata cython
MATHLIB=m pip3 install --no-build-isolation numpy