termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.97k stars 2.98k forks source link

[Bug]: pip install jupyter-ai fails to build #17573

Open Coderx7 opened 1 year ago

Coderx7 commented 1 year ago

Problem description

tried to install jupyter-ai by pip but faced build error.

here is the error log:

~ $ pip install jupyter_ai
Collecting jupyter_ai
  Obtaining dependency information for jupyter_ai from https://files.pythonhosted.org/packages/04/fb/664700ceabbe953548050c87b5865b6d68386854da710c20a6596b29c50e/jupyter_ai-2.0.0-py3-none-any.whl.metadata
  Using cached jupyter_ai-2.0.0-py3-none-any.whl.metadata (8.3 kB)
Collecting aiosqlite~=0.18 (from jupyter_ai)
  Using cached aiosqlite-0.19.0-py3-none-any.whl (15 kB)
Collecting dask[distributed] (from jupyter_ai)
  Obtaining dependency information for dask[distributed] from https://files.pythonhosted.org/packages/bc/07/af1299f8cff6f25cb406421eeb0948a4fbe7de1a49e23dfcd1a5b147919d/dask-2023.8.0-py3-none-any.whl.metadata
  Using cached dask-2023.8.0-py3-none-any.whl.metadata (3.6 kB)
Collecting faiss-cpu (from jupyter_ai)
  Using cached faiss-cpu-1.7.4.tar.gz (57 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [247 lines of output]
      Ignoring numpy: markers 'python_version < "3.5"' don't match your environment
      Collecting setuptools>=42
        Obtaining dependency information for setuptools>=42 from https://files.pythonhosted.org/packages/c7/42/be1c7bbdd83e1bfb160c94b9cafd8e25efc7400346cf7ccdbdb452c467fa/setuptools-68.0.0-py3-none-any.whl.metadata
        Using cached setuptools-68.0.0-py3-none-any.whl.metadata (6.4 kB)
      Collecting wheel
        Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/28/f5/6955d7b3a5d71ce6bac104f9cf98c1b0513ad656cdaca8ea7d579196f771/wheel-0.41.1-py3-none-any.whl.metadata
        Using cached wheel-0.41.1-py3-none-any.whl.metadata (2.2 kB)
      Collecting oldest-supported-numpy
        Obtaining dependency information for oldest-supported-numpy from https://files.pythonhosted.org/packages/94/9a/756fef9346e5ca2289cb70d73990b4c9f25446a885c1186cfb93a85e7da0/oldest_supported_numpy-2023.8.3-py3-none-any.whl.metadata
        Using cached oldest_supported_numpy-2023.8.3-py3-none-any.whl.metadata (9.5 kB)
      Collecting numpy==1.23.2 (from oldest-supported-numpy)
        Using cached numpy-1.23.2.tar.gz (10.7 MB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Using cached setuptools-68.0.0-py3-none-any.whl (804 kB)
      Using cached wheel-0.41.1-py3-none-any.whl (64 kB)
      Using cached oldest_supported_numpy-2023.8.3-py3-none-any.whl (4.8 kB)
      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/tmpdfp5gzx_/data
            creating /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/data/data
            creating /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/data/data/com.termux
            creating /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/data/data/com.termux/files
            creating /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/data/data/com.termux/files/usr
            creating /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/data/data/com.termux/files/usr/tmp
            creating /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/data/data/com.termux/files/usr/tmp/tmpdfp5gzx_
            INFO: compile options: '-c'
            INFO: aarch64-linux-android-clang: /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/source.c
            INFO: aarch64-linux-android-clang /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/source.o -L/data/data/com.termux/files/usr/lib -lopenblas -o /data/data/com.termux/files/usr/tmp/tmpdfp5gzx_/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/tmpyek9_e5h/data
            creating /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/data/data
            creating /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/data/data/com.termux
            creating /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/data/data/com.termux/files
            creating /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/data/data/com.termux/files/usr
            creating /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/data/data/com.termux/files/usr/tmp
            creating /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/data/data/com.termux/files/usr/tmp/tmpyek9_e5h
            INFO: compile options: '-c'
            INFO: aarch64-linux-android-clang: /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/source.c
            INFO: aarch64-linux-android-clang /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/data/data/com.termux/files/usr/tmp/tmpyek9_e5h/source.o -L/data/data/com.termux/files/usr/lib -lopenblas -o /data/data/com.termux/files/usr/tmp/tmpyek9_e5h/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-kyyc6whq/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-kyyc6whq/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-kyyc6whq/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-kyyc6whq/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-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/numpy/distutils/core.py", line 169, in setup
                return old_setup(**new_attr)
                       ^^^^^^^^^^^^^^^^^^^^^
              File "/data/data/com.termux/files/usr/tmp/pip-build-env-kyyc6whq/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-kyyc6whq/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-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/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-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/numpy/distutils/command/build_src.py", line 144, in run
                self.build_sources()
              File "/data/data/com.termux/files/usr/tmp/pip-install-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/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-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/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-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/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-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/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-37tyyrr7/numpy_14e0d9471a3e4aa7abfac772db2eb3b8/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.

doing pip install --no-build-isolation didn't work either.

What steps will reproduce the bug?

do pip install jupyter-ai

What is the expected behavior?

to be installed just fine.

System information

termux-info:

Termux Variables:
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=7198
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.iscas.ac.cn/termux/apt/termux-main stable main
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/21 termux extras
# root-repo (sources.list.d/root.list)
deb https://mirror.iscas.ac.cn/termux/apt/termux-root root stable
# x11-repo (sources.list.d/x11.list)
deb https://mirror.iscas.ac.cn/termux/apt/termux-x11 x11 main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
command-not-found/stable 2.2.0-11 aarch64 [upgradable from: 2.2.0-10]
mesa/stable 23.1.4-1 aarch64 [upgradable from: 23.1.4]
opencv-python/stable 4.8.0 aarch64 [upgradable from: 4.8.0]
opencv/stable 4.8.0 aarch64 [upgradable from: 4.8.0]
termux-tools/stable 1.38.5 all [upgradable from: 1.38.3]
termux-tools version:
1.38.3
Android version:
12
Kernel build information:
Linux localhost 4.14.190-perf-gc58615f0c505 #1 SMP PREEMPT Mon Jun 12 20:45:59 CST 2023 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
M2007J20CG
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.styling versionCode:30
romanovj commented 1 year ago

pkg install binutils-is-llvm libandroid-execinfo -y CFLAGS+=" -UANDROID_API -DANDROID_API=31" MATHLIB=m pip install numpy==1.23.2

sheneeb commented 3 months ago

Hi are you facing this issue $ pip install --force-reinstall faiss-cpu DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/statsmodels-0.0.0-py3.11-linux-aarch64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 Collecting faiss-cpu Using cached faiss-cpu-1.8.0.tar.gz (63 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting numpy (from faiss-cpu) Using cached numpy-1.26.4-cp311-cp311-linux_aarch64.whl Building wheels for collected packages: faiss-cpu Building wheel for faiss-cpu (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for faiss-cpu (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [12 lines of output] running bdist_wheel running build running build_py running build_ext building 'faiss._swigfaiss' extension swigging faiss/faiss/python/swigfaiss.i to faiss/faiss/python/swigfaiss_wrap.cpp swig -python -c++ -Doverride= -doxygen -Ifaiss -I/data/data/com.termux/files/usr/tmp/pip-build-env-ioqk4b0x/overlay/lib/python3.11/site-packages/numpy/core/include -Ifaiss -I/usr/local/include -DSWIGWORDSIZE64 -o faiss/faiss/python/swigfaiss_wrap.cpp faiss/faiss/python/swigfaiss.i Traceback (most recent call last): File "/data/data/com.termux/files/usr/bin/swig", line 5, in from swig import swig ModuleNotFoundError: No module named 'swig' error: command '/data/data/com.termux/files/usr/bin/swig' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for faiss-cpu Failed to build faiss-cpu ERROR: Could not build wheels for faiss-cpu, which is required to install pyproject.toml-based projects