Skip to content

Math Capabilities Detection Mechanism in v1.22.4 broken on Android Termux platform #21584

@ZhennanWu

Description

@ZhennanWu

Describe the issue:

The new math capabilities detection mechanism failed on Android Termux platform. Causing pip building failure. Bisection pinpointed the problem to be introduced between v1.22.3 to v1.22.4. Possibly due to f2119f9

Background

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. https://termux.com/

Reproduce the code example:

On a fresh Termux platform. Perform:

pkg install python 
pip install numpy==1.22.4

Error message:

Details
Collecting numpy==1.22.4
  Using cached numpy-1.22.4.zip (11.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for numpy (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [267 lines of output]
      Running from numpy source directory.
      /tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/tools/cythonize.py:63: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
        from distutils.version import LooseVersion
      Processing numpy/random/_bounded_integers.pxd.in
      Processing numpy/random/_mt19937.pyx
      Processing numpy/random/_generator.pyx
      Processing numpy/random/_philox.pyx
      Processing numpy/random/_bounded_integers.pyx.in
      Processing numpy/random/_common.pyx
      Processing numpy/random/_sfc64.pyx
      Processing numpy/random/bit_generator.pyx
      Processing numpy/random/_pcg64.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', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: blas_mkl_info:
      INFO:   libraries mkl_rt not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: blis_info:
      INFO:   libraries blis not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: openblas_info:
      INFO:   libraries openblas not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: accelerate_info:
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_3_10_blas_threads_info:
      INFO: Setting PTATLAS=ATLAS
      INFO:   libraries tatlas not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_3_10_blas_info:
      INFO:   libraries satlas not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_blas_threads_info:
      INFO: Setting PTATLAS=ATLAS
      INFO:   libraries ptf77blas,ptcblas,atlas not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_blas_info:
      INFO:   libraries f77blas,cblas,atlas not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      /tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/system_info.py:2077: UserWarning:
          Optimized (vendor) Blas libraries are not found.
          Falls back to netlib Blas library which has worse performance.
          A better performance should be easily gained by switching
          Blas library.
        if self._calc_info(blas):
      INFO: blas_info:
      INFO:   libraries blas not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      /tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/system_info.py:2077: UserWarning:
          Blas (http://www.netlib.org/blas/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [blas]) or by setting
          the BLAS environment variable.
        if self._calc_info(blas):
      INFO: blas_src_info:
      INFO:   NOT AVAILABLE
      INFO:
      /tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/system_info.py:2077: UserWarning:
          Blas (http://www.netlib.org/blas/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [blas_src]) or by setting
          the BLAS_SRC environment variable.
        if self._calc_info(blas):
      INFO:   NOT AVAILABLE
      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', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: lapack_mkl_info:
      INFO:   libraries mkl_rt not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: openblas_lapack_info:
      INFO:   libraries openblas not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: openblas_clapack_info:
      INFO:   libraries openblas,lapack not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: flame_info:
      INFO:   libraries flame not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_3_10_threads_info:
      INFO: Setting PTATLAS=ATLAS
      INFO:   libraries tatlas,tatlas not found in /data/data/com.termux/files/usr/lib
      INFO:   libraries tatlas,tatlas not found in /usr/local/lib
      INFO:   libraries tatlas,tatlas not found in /usr/lib
      INFO:   libraries tatlas,tatlas not found in /usr/lib/aarch64-linux-gnu
      INFO: <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_3_10_info:
      INFO:   libraries satlas,satlas not found in /data/data/com.termux/files/usr/lib
      INFO:   libraries satlas,satlas not found in /usr/local/lib
      INFO:   libraries satlas,satlas not found in /usr/lib
      INFO:   libraries satlas,satlas not found in /usr/lib/aarch64-linux-gnu
      INFO: <class 'numpy.distutils.system_info.atlas_3_10_info'>
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_threads_info:
      INFO: Setting PTATLAS=ATLAS
      INFO:   libraries ptf77blas,ptcblas,atlas not found in /data/data/com.termux/files/usr/lib
      INFO:   libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
      INFO:   libraries ptf77blas,ptcblas,atlas not found in /usr/lib
      INFO:   libraries ptf77blas,ptcblas,atlas not found in /usr/lib/aarch64-linux-gnu
      INFO: <class 'numpy.distutils.system_info.atlas_threads_info'>
      INFO:   NOT AVAILABLE
      INFO:
      INFO: atlas_info:
      INFO:   libraries f77blas,cblas,atlas not found in /data/data/com.termux/files/usr/lib
      INFO:   libraries f77blas,cblas,atlas not found in /usr/local/lib
      INFO:   libraries f77blas,cblas,atlas not found in /usr/lib
      INFO:   libraries f77blas,cblas,atlas not found in /usr/lib/aarch64-linux-gnu
      INFO: <class 'numpy.distutils.system_info.atlas_info'>
      INFO:   NOT AVAILABLE
      INFO:
      INFO: lapack_info:
      INFO:   libraries lapack not found in ['/data/data/com.termux/files/usr/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      INFO:   NOT AVAILABLE
      INFO:
      /tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/system_info.py:1902: UserWarning:
          Lapack (http://www.netlib.org/lapack/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [lapack]) or by setting
          the LAPACK environment variable.
        return getattr(self, '_calc_info_{}'.format(name))()
      INFO: lapack_src_info:
      INFO:   NOT AVAILABLE
      INFO:
      /tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/system_info.py:1902: UserWarning:
          Lapack (http://www.netlib.org/lapack/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [lapack_src]) or by setting
          the LAPACK_SRC environment variable.
        return getattr(self, '_calc_info_{}'.format(name))()
      INFO:   NOT AVAILABLE
      INFO:
      INFO: numpy_linalg_lapack_lite:
      INFO:   FOUND:
      INFO:     language = c
      INFO:     define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]
      INFO:
      Warning: attempted relative import with no known parent package
      /data/data/com.termux/files/usr/lib/python3.10/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.10
      creating build/src.linux-aarch64-3.10/numpy
      creating build/src.linux-aarch64-3.10/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.10/numpy/core
      creating build/src.linux-aarch64-3.10/numpy/core/src
      creating build/src.linux-aarch64-3.10/numpy/core/src/npymath
      INFO: conv_template:> build/src.linux-aarch64-3.10/numpy/core/src/npymath/npy_math_internal.h
      INFO:   adding 'build/src.linux-aarch64-3.10/numpy/core/src/npymath' to include_dirs.
      INFO: conv_template:> build/src.linux-aarch64-3.10/numpy/core/src/npymath/ieee754.c
      INFO: conv_template:> build/src.linux-aarch64-3.10/numpy/core/src/npymath/npy_math_complex.c
      INFO: None - nothing done with h_files = ['build/src.linux-aarch64-3.10/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.10/numpy/core/src/multiarray
      INFO: conv_template:> build/src.linux-aarch64-3.10/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.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-wqbb3dac/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 230, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/tmp/pip-build-env-wqbb3dac/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-wqbb3dac/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 267, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-wqbb3dac/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 461, in <module>
          setup_package()
        File "setup.py", line 453, in setup_package
          setup(**metadata)
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/core.py", line 169, in setup
          return old_setup(**new_attr)
        File "/tmp/pip-build-env-wqbb3dac/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-wqbb3dac/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/command/build.py", line 61, in run
          old_build.run(self)
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/data/data/com.termux/files/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/command/build_src.py", line 144, in run
          self.build_sources()
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/command/build_src.py", line 161, in build_sources
          self.build_extension_sources(ext)
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/command/build_src.py", line 318, in build_extension_sources
          sources = self.generate_sources(sources, ext)
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/distutils/command/build_src.py", line 378, in generate_sources
          source = func(extension, build_dir)
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/core/setup.py", line 508, in generate_config_h
          check_math_capabilities(config_cmd, ext, moredefs, mathlibs)
        File "/tmp/pip-install-l_b969kc/numpy_d263c90bfe74495e84354e70cb670407/numpy/core/setup.py", line 171, 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


### NumPy/Python version information:

Python version: 3.10.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions