termux / termux-packages

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

[Bug]: pip install numpy #18885

Open r8kbg opened 9 months ago

r8kbg commented 9 months ago

Problem description

https://gist.github.com/r8kbg/fe752603f014c91527364782d80443b1

What steps will reproduce the bug?

MATHLIB=m pip install numpy==1.24.2

What is the expected behavior?

installed numpy

System information

termux-info: Termux Variables: TERMUX_APK_RELEASE=F_DROID TERMUX_APP_PACKAGE_MANAGER=apt TERMUX_APP_PID=2168 TERMUX_IS_DEBUGGABLE_BUILD=0 TERMUX_MAIN_PACKAGE_FORMAT=debian TERMUX_VERSION=0.118.0 TERMUX__USER_ID=0 Packages CPU architecture: arm Subscribed repositories:

sources.list

deb https://packages-cf.termux.dev/apt/termux-main stable main

sources.list.d/pointless.list

deb https://its-pointless.github.io/files/21 termux extras Updatable packages: All packages up to date termux-tools version: 1.40.4 Android version: 9 Kernel build information: Linux localhost 3.10.108-gb16e5db74e4-04754-g98189a13766 #1 SMP PREEMPT Wed Oct 10 18:00:43 +03 2018 armv7l Android Device manufacturer: samsung Device model: SM-A300F LD Variables: LD_LIBRARY_PATH= LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so

2096779623 commented 9 months ago

pkg i python-numpy

trosh commented 9 months ago

I can install numpy with python-numpy, but if I then want to install tzwhere then it seems to try to build numpy nonetheless... and fail even with MATHLIB or LDFLAGS env vars

~ $ pkg install python-numpy
...
~ $ MATHLIB=m pip install numpy
Requirement already satisfied: numpy in /data/data/com.termux/files/usr/lib/python3.11/site-packages (1.26.3)
~ $ MATHLIB=m pip install tzwhere
Collecting tzwhere
  Using cached tzwhere-3.0.3.tar.gz (23.7 MB)
  Preparing metadata (setup.py) ... done
Collecting shapely (from tzwhere)
  Using cached shapely-2.0.2.tar.gz (279 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [923 lines of output]
      Collecting Cython
        Using cached Cython-3.0.7-py2.py3-none-any.whl.metadata (3.2 kB)
      Collecting oldest-supported-numpy
        Using cached oldest_supported_numpy-2023.12.21-py3-none-any.whl.metadata (9.8 kB)
      Collecting setuptools>=61.0.0
        Using cached setuptools-69.0.3-py3-none-any.whl.metadata (6.3 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 Cython-3.0.7-py2.py3-none-any.whl (1.2 MB)
      Using cached oldest_supported_numpy-2023.12.21-py3-none-any.whl (4.9 kB)
      Using cached setuptools-69.0.3-py3-none-any.whl (819 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
        ╰─> [892 lines of output]
...

Thanks for any help.

2096779623 commented 9 months ago

https://github.com/termux/termux-packages/issues/17573#issuecomment-1670058242

trosh commented 9 months ago

Not fond of the hardcoded versions but fond of it working.

Had to add libgeos for shapely (a tzwhere dependency), so in case anybody is following the slightly-more-complete workaround is:

pkg install binutils-is-llvm libandroid-execinfo libgeos
CFLAGS+=" -U__ANDROID_API__ -D__ANDROID_API__=31" MATHLIB=m pip install numpy==1.23.2 tzwhere