scikit-learn / scikit-learn

scikit-learn: machine learning in Python
https://scikit-learn.org
BSD 3-Clause "New" or "Revised" License
59.42k stars 25.25k forks source link

Build failure under Termux: can not execute sklearn/_build_utils/version.py #29367

Closed Manamama closed 2 months ago

Manamama commented 2 months ago

Describe the bug

When attempting to install the newest (and older) versions of scikit-learn-1.6.dev0 using regular pip install, the installation fails due to a missing version.py file. This issue occurs on an Android system using Termux. Environment details: OS: Linux localhost 4.14.186+ (Android) Architecture: aarch64 Python: 3.11 The error occurs during the Meson build process, which tries to execute a non-existent file: /data/data/com.termux/files/home/downloads/scikit-learn/sklearn/_build_utils/version.py A workaround patch has been developed to address this issue:

#!/bin/bash

# Navigate to the scikit-learn directory, e.g.:
cd ~/downloads/scikit-learn

# Extract version from pyproject.toml and remove "dev" suffix
VERSION=$(grep 'version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/' | sed 's/\.dev0//')

# Create the directory if it doesn't exist
mkdir -p sklearn/_build_utils

# Create the version.py file with the correct content
cat << EOF > sklearn/_build_utils/version.py
#!/usr/bin/env python
print('${VERSION}')
EOF

# Make the file executable
chmod +x sklearn/_build_utils/version.py

echo "Created sklearn/_build_utils/version.py with version ${VERSION}"

This patch:

After applying this patch, the Meson build process completes successfully, and the installation can proceed:

cpu family: aarch64
Host machine cpu: aarch64
Compiler for C supports arguments -Wno-unused-but-set-variable: YE
Compiler for C supports arguments -Wno-unused-function: YES
Compiler for C supports arguments -Wno-conversion: YES
Compiler for C supports arguments -Wno-misleading-indentation: YES
Library m found: YES
Program python3 found: YES (/data/data/com.termux/files/usr/bin/python3.11)
Run-time dependency OpenMP for c found: YES 5.1
Found pkg-config: YES (/data/data/com.termux/files/usr/bin/pkg-config) 0.29.2
Run-time dependency python found: YES 3.11    Build targets in project: 111
Found ninja-1.11.1.git.kitware.jobserver-1 ...

and:

Successfully installed scikit-learn-1.6.dev0  ~/downloads/scikit-learn $

Steps/Code to Reproduce

pip install -U -v scikit-learn

Expected Results

.

Actual Results

.

Versions

scikit-learn-1.6.dev0, and older
lesteve commented 2 months ago

Hmmm this is weird, since sklearn/_build_utils/version.py is inside the git repository, see https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/_build_utils/version.py.

Can you explain how you download scikit-learn, i.e. how do you create ~/downloads/scikit-learn folder and contents?

Manamama commented 2 months ago

As I wrote: using regular pip install and "Steps/Code to Reproduce pip install -U -v scikit-learn" . (Also after git clone etc.). Let me retry today.

  1. Uninstalling the manually patched version:
    
    /data/data/com.termux/files/usr/lib/python3.11/site-packages/sklearn/utils/murmurhash.cpython-311-aarch64-linux-gnu.so
    /data/data/com.termux/files/usr/lib/python3.11/site-packages/sklearn/utils/sparsefuncs_fast.cpython-311-aarch64-linux-gnu.so
    Proceed (Y/n)? y
    Successfully uninstalled scikit-learn-1.6.dev0

2. Uninstalling yet another version, not sure where it came from - possibly patched in a similar way: 
/data/data/com.termux/files/usr/lib/python3.11/site-packages/sklearn/utils/arrayfuncs.cpython-311-aarch64-linux-gnu.so
/data/data/com.termux/files/usr/lib/python3.11/site-packages/sklearn/utils/murmurhash.cpython-311-aarch64-linux-gnu.so
/data/data/com.termux/files/usr/lib/python3.11/site-packages/sklearn/utils/sparsefuncs_fast.cpython-311-aarch64-linux-gnu.so

Proceed (Y/n)? y Successfully uninstalled scikit-learn-1.5.0


3. Now installing the regular way:

~/downloads $ pip install -U -v scikit-learn Using pip 24.1.1 from /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip (python 3.11) Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu Collecting scikit-learn Using cached scikit_learn-1.5.0.tar.gz (7.8 MB) Running command pip subprocess to install build dependencies Using pip 24.1.1 from /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip (python 3.11) Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu, https://download.pytorch.org/whl/cpu Collecting meson-python>=0.15.0 Obtaining dependency information for meson-python>=0.15.0 from https://files.pythonhosted.org/packages/91/c0/104cb6244c83fe6bc3886f144cc433db0c0c78efac5dc00e409a5a08c87d/meson_python-0.16.0-py3-none-any.whl.metadata Using cached meson_python-0.16.0-py3-none-any.whl.metadata (4.1 kB) Collecting Cython>=3.0.10 Obtaining dependency information for Cython>=3.0.10 from https://files.pythonhosted.org/packages/b6/83/b0a63fc7b315edd46821a1a381d18765c1353d201246da44558175cddd56/Cython-3.0.10-py2.py3-none-any.whl.metadata Using cached Cython-3.0.10-py2.py3-none-any.whl.metadata (3.2 kB) Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/3a/be/650f9c091ef71cb01d735775d554e068752d3ff63d7943b26316dc401749/numpy-1.21.2.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11) Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/5f/d6/ad58ded26556eaeaa8c971e08b6466f17c4ac4d786cd3d800e26ce59cc01/numpy-1.21.3.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11) Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/fb/48/b0708ebd7718a8933f0d3937513ef8ef2f4f04529f1f66ca86d873043921/numpy-1.21.4.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11) Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/c2/a8/a924a09492bdfee8c2ec3094d0a13f2799800b4fdc9c890738aeeb12c72e/numpy-1.21.5.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11) Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/45/b7/de7b8e67f2232c26af57c205aaad29fe17754f793404f59c8a730c7a191a/numpy-1.21.6.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11) Collecting numpy>=2.0.0rc2 Using cached numpy-2.0.0-cp311-cp311-linux_aarch64.whl Link requires a different Python (3.11.9 not in: '>=3.7,<3.10'): https://files.pythonhosted.org/packages/99/f1/c00d6be56e1a718a3068079e3ec8ce044d7179345280f6a3f5066068af0d/scipy-1.6.2.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.10) Link requires a different Python (3.11.9 not in: '>=3.7,<3.10'): https://files.pythonhosted.org/packages/fe/fd/8704c7b7b34cdac850485e638346025ca57c5a859934b9aa1be5399b33b7/scipy-1.6.3.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.10) Link requires a different Python (3.11.9 not in: '>=3.7,<3.10'): https://files.pythonhosted.org/packages/bb/bb/944f559d554df6c9adf037aa9fc982a9706ee0e96c0d5beac701cb158900/scipy-1.7.0.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.10) Link requires a different Python (3.11.9 not in: '>=3.7,<3.10'): https://files.pythonhosted.org/packages/47/33/a24aec22b7be7fdb10ec117a95e1e4099890d8bbc6646902f443fc7719d1/scipy-1.7.1.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.10) Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/0e/23/58c4f995475a2a97cb5f4a032aedaf881ad87cd976a7180c55118d105a1d/scipy-1.7.2.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.11) Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/61/67/1a654b96309c991762ee9bc39c363fc618076b155fe52d295211cf2536c7/scipy-1.7.3.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.11) Link requires a different Python (3.11.9 not in: '>=3.8,<3.11'): https://files.pythonhosted.org/packages/c0/ad/e3c052ed4e0027a8abef0a5e8441a044427d252d17d9aee06d56e62fc698/scipy-1.8.0rc1.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.8,<3.11) Link requires a different Python (3.11.9 not in: '>=3.8,<3.11'): https://files.pythonhosted.org/packages/29/d2/151a54944b333e465f98804dced31dab1284f3c37b752b9cefa710b64681/scipy-1.8.0rc2.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.8,<3.11) Link requires a different Python (3.11.9 not in: '>=3.8,<3.11'): https://files.pythonhosted.org/packages/e4/26/83dd1c6378513a6241d984bda9f08c512b6e35fff13fba3acc1b3c195f02/scipy-1.8.0rc3.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.8,<3.11) Link requires a different Python (3.11.9 not in: '>=3.8,<3.11'): https://files.pythonhosted.org/packages/22/78/056cc43e7737811b6f50886788a940f852773dd9804f5365952805db9648/scipy-1.8.0rc4.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.8,<3.11) Link requires a different Python (3.11.9 not in: '>=3.8,<3.11'): https://files.pythonhosted.org/packages/b4/a2/4faa34bf0cdbefd5c706625f1234987795f368eb4e97bde9d6f46860843e/scipy-1.8.0.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.8,<3.11) Link requires a different Python (3.11.9 not in: '>=3.8,<3.11'): https://files.pythonhosted.org/packages/26/b5/9330f004b9a3b2b6a31f59f46f1617ce9ca15c0e7fe64288c20385a05c9d/scipy-1.8.1.tar.gz (from https://pypi.org/simple/scipy/) (requires-python:>=3.8,<3.11) Collecting scipy>=1.6.0 Using cached scipy-1.14.0-cp311-cp311-linux_aarch64.whl Collecting meson>=0.63.3 (from meson-python>=0.15.0) Obtaining dependency information for meson>=0.63.3 from https://files.pythonhosted.org/packages/44/b2/d4433391a7c5e94a39b50ca7295a8ceba736e7c72c455752a60122f52453/meson-1.4.1-py3-none-any.whl.metadata Using cached meson-1.4.1-py3-none-any.whl.metadata (1.8 kB) Collecting packaging>=19.0 (from meson-python>=0.15.0) Obtaining dependency information for packaging>=19.0 from https://files.pythonhosted.org/packages/08/aa/cc0199a5f0ad350994d660967a8efb233fe0416e4639146c089643407ce6/packaging-24.1-py3-none-any.whl.metadata Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB) Collecting pyproject-metadata>=0.7.1 (from meson-python>=0.15.0) Obtaining dependency information for pyproject-metadata>=0.7.1 from https://files.pythonhosted.org/packages/aa/5f/bb5970d3d04173b46c9037109f7f05fc8904ff5be073ee49bb6ff00301bc/pyproject_metadata-0.8.0-py3-none-any.whl.metadata Using cached pyproject_metadata-0.8.0-py3-none-any.whl.metadata (3.0 kB) Using cached meson_python-0.16.0-py3-none-any.whl (26 kB) Using cached Cython-3.0.10-py2.py3-none-any.whl (1.2 MB) Using cached meson-1.4.1-py3-none-any.whl (937 kB) Using cached packaging-24.1-py3-none-any.whl (53 kB) Using cached pyprojectmetadata-0.8.0-py3-none-any.whl (7.5 kB) Installing collected packages: packaging, numpy, meson, Cython, scipy, pyproject-metadata, meson-python Creating /data/data/com.termux/files/usr/tmp/pip-build-env-kd2fzqe/overlay/bin changing mode of /data/data/com.termux/files/usr/tmp/pip-build-env-kd2fzqe/overlay/bin/f2py to 755 changing mode of /data/data/com.termux/files/usr/tmp/pip-build-env-kd2fzqe/overlay/bin/numpy-config to 755 changing mode of /data/data/com.termux/files/usr/tmp/pip-build-env-kd2fzqe/overlay/bin/meson to 755 changing mode of /data/data/com.termux/files/usr/tmp/pip-build-env-kd2fzqe/overlay/bin/cygdb to 755 changing mode of /data/data/com.termux/files/usr/tmp/pip-build-env-kd2fzqe/overlay/bin/cython to 755 changing mode of /data/data/com.termux/files/usr/tmp/pip-build-env-kd2fzqe/overlay/bin/cythonize to 755 ... Successfully installed Cython-3.0.10 meson-1.4.1 meson-python-0.16.0 numpy-2.0.0 packaging-24.1 pyproject-metadata-0.8.0 scipy-1.14.0 Installing build dependencies ... done Running command Getting requirements to build wheel Getting requirements to build wheel ... done Running command Preparing metadata (pyproject.toml)

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details. ~/downloads $



So the identical error. 

I hope that helps. 
lesteve commented 2 months ago

Thanks for the details, I am not familiar with termux at all, so this is not that easy to figure out what is going on ...

From what I can gather from your logs:

Here is a suggestion of things you could try to help:

lesteve commented 2 months ago

Not crucial, but I would also be curious what your use case is for termux and scikit-learn :wink:. Is it for running small scikit-learn snippets on your phone? Do you do Python development on your phone?

Manamama commented 2 months ago

FYI, after the fix: (downlading all via git clone etc).

 Running command Preparing metadata (pyproject.toml)
  + meson setup /data/data/com.termux/files/home/downloads/scikit-learn /data/data/com.termux/files/home/downloads/scikit-learn/.mesonpy-1hzjaqq3 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/data/data/com.termux/files/home/downloads/scikit-learn/.mesonpy-1hzjaqq3/meson-python-native-file.ini
  The Meson build system
  Version: 1.4.1
  Source dir: /data/data/com.termux/files/home/downloads/scikit-learn
  Build dir: /data/data/com.termux/files/home/downloads/scikit-learn/.mesonpy-1hzjaqq3
  Build type: native build
  Project name: scikit-learn
  Project version: 1.6
  C compiler for the host machine: clang (clang 18.1.8 "clang version 18.1.8")
  C linker for the host machine: clang ld.lld 18.1.8
  C++ compiler for the host machine: clang++ (clang 18.1.8 "clang version 18.1.8")
  C++ linker for the host machine: clang++ ld.lld 18.1.8
  Cython compiler for the host machine: cython (cython 3.0.10)
  Host machine cpu family: aarch64
  Host machine cpu: aarch64
  Compiler for C supports arguments -Wno-unused-but-set-variable: YES
  Compiler for C supports arguments -Wno-unused-function: YES
  Compiler for C supports arguments -Wno-conversion: YES
  Compiler for C supports arguments -Wno-misleading-indentation: YES
  Library m found: YES
  Program python found: YES (/data/data/com.termux/files/usr/bin/python3.11)
  Run-time dependency OpenMP for c found: YES 5.1
  Found pkg-config: YES (/data/data/com.termux/files/usr/bin/pkg-config) 0.29.2
  Run-time dependency python found: YES 3.11
  Build targets in project: 111

  scikit-learn 1.6

    User defined options
      Native files: /data/data/com.termux/files/home/downloads/scikit-learn/.mesonpy-1hzjaqq3/meson-python-native-file.ini
      buildtype   : release
      b_ndebug    : if-release
      b_vscrt     : md

  Found samurai-1.9 at /data/data/com.termux/files/usr/bin/samu
  + /data/data/com.termux/files/usr/bin/samu
  [1/249] Compiling C++ object sklearn/svm/libliblinear-skl.a.p/src_liblinear_tron.cpp.o
... 

so it works.

My use case? Banal. Many of these require it:

Required-by: audiolm-pytorch, hdbscan, librosa, lm-eval, mlflow, nemo-toolkit, pyannote.metrics, pyannote.pipeline, pynndescent, pytorch-metric-learning, sentence-transformers, seqeval, shap, top2vec, TTS, umap-learn ...

And when trying to install it via their requirements it errors out as above. (Only in Termux - Ubuntu etc work fine as they use ready compiled bits, so no meson.) I have a vague recollection that the older scikit learn versions, possibly pre 1.5 worked fine there.

Manamama commented 2 months ago

OK, trying your experiment then - unistalling yet again and pip install scikit-learn==1.4.2 -v ...

/downloads/scikit-learn $ pip install scikit-learn==1.4.2 -v
Using pip 24.1.1 from /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip (python 3.11)
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu
Collecting scikit-learn==1.4.2
  Downloading scikit-learn-1.4.2.tar.gz (7.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.8/7.8 MB 950.2 kB/s eta 0:00:00
  Running command pip subprocess to install build dependencies
  Using pip 24.1.1 from /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip (python 3.11)
  Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu, https://download.pytorch.org/whl/cpu
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/42/54/2a8ecfcc9a714a6fbf86559a4b0f50b126a4ac4269ea8134f2c75c3e73de/setuptools-70.2.0-py3-none-any.whl.metadata
    Downloading setuptools-70.2.0-py3-none-any.whl.metadata (5.8 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/7d/cd/d7460c9a869b16c3dd4e1e403cce337df165368c71d6af229a74699622ce/wheel-0.43.0-py3-none-any.whl.metadata
    Using cached wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB)
  Collecting Cython>=3.0.8
    Obtaining dependency information for Cython>=3.0.8 from https://files.pythonhosted.org/packages/b6/83/b0a63fc7b315edd46821a1a381d18765c1353d201246da44558175cddd56/Cython-3.0.10-py2.py3-none-any.whl.metadata
    Using cached Cython-3.0.10-py2.py3-none-any.whl.metadata (3.2 kB)
    Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/3a/be/650f9c091ef71cb01d735775d554e068752d3ff63d7943b26316dc401749/numpy-1.21.2.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
    Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/5f/d6/ad58ded26556eaeaa8c971e08b6466f17c4ac4d786cd3d800e26ce59cc01/numpy-1.21.3.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
    Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/fb/48/b0708ebd7718a8933f0d3937513ef8ef2f4f04529f1f66ca86d873043921/numpy-1.21.4.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
    Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/c2/a8/a924a09492bdfee8c2ec3094d0a13f2799800b4fdc9c890738aeeb12c72e/numpy-1.21.5.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
    Link requires a different Python (3.11.9 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/45/b7/de7b8e67f2232c26af57c205aaad29fe17754f793404f59c8a730c7a191a/numpy-1.21.6.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
  Collecting numpy==2.0.0rc1
    Downloading numpy-2.0.0rc1.tar.gz (18.3 MB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.3/18.3 MB 965.4 kB/s eta 0:00:00
    Installing build dependencies: started
    Running command pip subprocess to install build dependencies
    Using pip 24.1.1 from /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip (python 3.11)
    Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu, https://download.pytorch.org/whl/cpu, https://download.pytorch.org/whl/cpu
    Collecting meson-python>=0.15.0
      Obtaining dependency information for meson-python>=0.15.0 from https://files.pythonhosted.org/packages/91/c0/104cb6244c83fe6bc3886f144cc433db0c0c78efac5dc00e409a5a08c87d/meson_python-0.16.0-py3-none-any.whl.metadata
      Using cached meson_python-0.16.0-py3-none-any.whl.metadata (4.1 kB)
    Collecting Cython>=3.0.6
      Obtaining dependency information for Cython>=3.0.6 from https://files.pythonhosted.org/packages/b6/83/b0a63fc7b315edd46821a1a381d18765c1353d201246da44558175cddd56/Cython-3.0.10-py2.py3-none-any.whl.metadata
      Using cached Cython-3.0.10-py2.py3-none-any.whl.metadata (3.2 kB)
    Collecting meson>=0.63.3 (from meson-python>=0.15.0)
      Obtaining dependency information for meson>=0.63.3 from https://files.pythonhosted.org/packages/44/b2/d4433391a7c5e94a39b50ca7295a8ceba736e7c72c455752a60122f52453/meson-1.4.1-py3-none-any.whl.metadata
      Using cached meson-1.4.1-py3-none-any.whl.metadata (1.8 kB)
    Collecting packaging>=19.0 (from meson-python>=0.15.0)
      Obtaining dependency information for packaging>=19.0 from https://files.pythonhosted.org/packages/08/aa/cc0199a5f0ad350994d660967a8efb233fe0416e4639146c089643407ce6/packaging-24.1-py3-none-any.whl.metadata
      Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
    Collecting pyproject-metadata>=0.7.1 (from meson-python>=0.15.0)
      Obtaining dependency information for pyproject-metadata>=0.7.1 from https://files.pythonhosted.org/packages/aa/5f/bb5970d3d04173b46c9037109f7f05fc8904ff5be073ee49bb6ff00301bc/pyproject_metadata-0.8.0-py3-none-any.whl.metadata
      Using cached pyproject_metadata-0.8.0-py3-none-any.whl.metadata (3.0 kB)
    Using cached meson_python-0.16.0-py3-none-any.whl (26 kB)
    Using cached Cython-3.0.10-py2.py3-none-any.whl (1.2 MB)
    Using cached meson-1.4.1-py3-none-any.whl (937 kB)
    Using cached packaging-24.1-py3-none-any.whl (53 kB)
    Using cached pyproject_metadata-0.8.0-py3-none-any.whl (7.5 kB)
    Installing collected packages: packaging, meson, Cython, pyproject-metadata, meson-python
...
   Successfully installed Cython-3.0.10 meson-1.4.1 meson-python-0.16.0 packaging-24.1 pyproject-metadata-0.8.0
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Running command Getting requirements to build wheel
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Running command Preparing metadata (pyproject.toml)
    + /data/data/com.termux/files/usr/bin/python3.11 /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938/vendored-meson/meson/meson.py setup /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938 /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938/.mesonpy-lbak84mc -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938/.mesonpy-lbak84mc/meson-python-native-file.ini
    The Meson build system
    Version: 1.2.99
    Source dir: /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938
    Build dir: /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938/.mesonpy-lbak84mc
    Build type: native build
    Project name: NumPy
    Project version: 2.0.0rc1
    C compiler for the host machine: clang (clang 18.1.8 "clang version 18.1.8")
    C linker for the host machine: clang ld.lld 18.1.8
    C++ compiler for the host machine: clang++ (clang 18.1.8 "clang version 18.1.8")
    C++ linker for the host machine: clang++ ld.lld 18.1.8
    Cython compiler for the host machine: cython (cython 3.0.10)
    Host machine cpu family: aarch64
    Host machine cpu: aarch64
    Program python found: YES (/data/data/com.termux/files/usr/bin/python3.11)
    Found pkg-config: /data/data/com.termux/files/usr/bin/pkg-config (0.29.2)
    Run-time dependency python found: YES 3.11
    Has header "Python.h" with dependency python-3.11: YES
    Compiler for C supports arguments -fno-strict-aliasing: YES
    Compiler for C supports arguments -ftrapping-math: YES
    Message: During parsing cpu-dispatch: The following CPU features were ignored due to platform incompatibility or lack of support:
    "XOP FMA4"
    Test features "NEON NEON_FP16 NEON_VFPV4 ASIMD" : Supported
    Test features "ASIMDHP" : Supported
    Test features "ASIMDFHM" : Supported
    Test features "SVE" : Supported
    Configuring npy_cpu_dispatch_config.h using configuration
    Message:
    CPU Optimization Options
      baseline:
        Requested : min
        Enabled   : NEON NEON_FP16 NEON_VFPV4 ASIMD
      dispatch:
        Requested : max -xop -fma4
        Enabled   : ASIMDHP ASIMDFHM SVE

    Library m found: YES
    Run-time dependency scipy-openblas found: NO (tried pkgconfig)
    Run-time dependency openblas found: YES 0.3.27
    Message: BLAS symbol suffix:
    Run-time dependency openblas found: YES 0.3.27
    Program _build_utils/process_src_template.py found: YES (/data/data/com.termux/files/usr/bin/python3.11 /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938/numpy/_build_utils/process_src_template.py)
    Program _build_utils/tempita.py found: YES (/data/data/com.termux/files/usr/bin/python3.11 /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938/numpy/_build_utils/tempita.py)
    Configuring __config__.py using configuration
    Checking for size of "short" : 2
    Checking for size of "int" : 4
    Checking for size of "long" : 8
    Checking for size of "long long" : 8
    Checking for size of "float" : 4
    Checking for size of "double" : 8
    Checking for size of "long double" : 16
    Checking for size of "size_t" : 8
    Checking for size of "size_t" : 8 (cached)
    Checking for size of "wchar_t" : 4
    Checking for size of "off_t" : 8
    Checking for size of "Py_intptr_t" with dependency python-3.11: 8
    Checking for size of "PY_LONG_LONG" with dependency python-3.11: 8
    Has header "complex.h" : YES
    Checking for type "complex float" : YES
    Checking for size of "complex float" : 8
    Checking for type "complex double" : YES
    Checking for size of "complex double" : 16
    Checking for type "complex long double" : YES
    Checking for size of "complex long double" : 32
    Checking for function "sin" with dependency -lm: YES
    Checking for function "cos" with dependency -lm: YES
    Checking for function "tan" with dependency -lm: YES
    Checking for function "sinh" with dependency -lm: YES
    Checking for function "cosh" with dependency -lm: YES
    Checking for function "tanh" with dependency -lm: YES
    Checking for function "fabs" with dependency -lm: YES
    Checking for function "floor" with dependency -lm: YES
    Checking for function "ceil" with dependency -lm: YES
    Checking for function "sqrt" with dependency -lm: YES
    Checking for function "log10" with dependency -lm: YES
    Checking for function "log" with dependency -lm: YES
    Checking for function "exp" with dependency -lm: YES
    Checking for function "asin" with dependency -lm: YES
    Checking for function "acos" with dependency -lm: YES
    Checking for function "atan" with dependency -lm: YES
    Checking for function "fmod" with dependency -lm: YES
    Checking for function "modf" with dependency -lm: YES
    Checking for function "frexp" with dependency -lm: YES
    Checking for function "ldexp" with dependency -lm: YES
    Checking for function "expm1" with dependency -lm: YES
    Checking for function "log1p" with dependency -lm: YES
    Checking for function "acosh" with dependency -lm: YES
    Checking for function "asinh" with dependency -lm: YES
    Checking for function "atanh" with dependency -lm: YES
    Checking for function "rint" with dependency -lm: YES
    Checking for function "trunc" with dependency -lm: YES
    Checking for function "exp2" with dependency -lm: YES
    Checking for function "copysign" with dependency -lm: YES
    Checking for function "nextafter" with dependency -lm: YES
    Checking for function "cbrt" with dependency -lm: YES
    Checking for function "log2" with dependency -lm: YES
    Checking for function "pow" with dependency -lm: YES
    Checking for function "hypot" with dependency -lm: YES
    Checking for function "atan2" with dependency -lm: YES
    Checking for function "csin" with dependency -lm: YES
    Checking for function "csinh" with dependency -lm: YES
    Checking for function "ccos" with dependency -lm: YES
    Checking for function "ccosh" with dependency -lm: YES
    Checking for function "ctan" with dependency -lm: YES
    Checking for function "ctanh" with dependency -lm: YES
    Checking for function "creal" with dependency -lm: YES
    Checking for function "cimag" with dependency -lm: YES
    Checking for function "conj" with dependency -lm: YES
    Checking for function "strtoll" : YES
    Checking for function "strtoull" : YES
    Checking for function "cabs" with dependency -lm: YES
    Checking for function "cabsf" with dependency -lm: YES
    Checking for function "cabsl" with dependency -lm: YES
    Checking for function "cacos" with dependency -lm: YES
    Checking for function "cacosf" with dependency -lm: YES
    Checking for function "cacosl" with dependency -lm: NO
    Checking for function "cacosh" with dependency -lm: YES
    Checking for function "cacoshf" with dependency -lm: YES
    Checking for function "cacoshl" with dependency -lm: NO
    Checking for function "carg" with dependency -lm: YES
    Checking for function "cargf" with dependency -lm: YES
    Checking for function "cargl" with dependency -lm: YES
    Checking for function "casin" with dependency -lm: YES
    Checking for function "casinf" with dependency -lm: YES
    Checking for function "casinl" with dependency -lm: NO
    Checking for function "casinh" with dependency -lm: YES
    Checking for function "casinhf" with dependency -lm: YES
    Checking for function "casinhl" with dependency -lm: NO
    Checking for function "catan" with dependency -lm: YES
    Checking for function "catanf" with dependency -lm: YES
    Checking for function "catanl" with dependency -lm: NO
    Checking for function "catanh" with dependency -lm: YES
    Checking for function "catanhf" with dependency -lm: YES
    Checking for function "catanhl" with dependency -lm: NO
    Checking for function "cexp" with dependency -lm: YES
    Checking for function "cexpf" with dependency -lm: YES
    Checking for function "cexpl" with dependency -lm: NO
    Checking for function "clog" with dependency -lm: NO
    Checking for function "clogf" with dependency -lm: NO
    Checking for function "clogl" with dependency -lm: NO
    Checking for function "cpow" with dependency -lm: NO
    Checking for function "cpowf" with dependency -lm: NO

(this section does not show in these post-1.5 versions) and it compiles fine, out of the box:

    Build targets in project: 64

    NumPy 2.0.0rc1

      User defined options
        Native files: /data/data/com.termux/files/usr/tmp/pip-install-w7wscwpd/numpy_e355c9e781754228991407e3a9385938/.mesonpy-lbak84mc/meson-python-native-file.ini
        buildtype   : release
        b_ndebug    : if-release
        b_vscrt     : md

    Found samurai-1.9 at /data/data/com.termux/files/usr/bin/samu
    + /data/data/com.termux/files/usr/bin/samu
    [1/322] Generating numpy/random/_bounded_integer_pyx with a custom command
    [2/322] Generating numpy/random/mtrand.pyx with a custom command
    [3/322] Generating numpy/random/_generator.pyx with a custom command
    [4/322] Generating numpy/random/_bounded_integer_pxd with a custom command
    [5/322] Generating numpy/random/c_distributions.pxd with a custom command
    [6/322] Generating numpy/random/bit_generator.pxd with a custom command
    [7/322] Generating numpy/random/_common.pxd with a custom command

and then lots of:

 clang -shared -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -fno-openmp-implicit-rpath -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r26b-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 -fno-openmp-implicit-rpath -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r26b-api-24-v4/sysroot/usr/lib -lm -lpython3.11 -llog build/temp.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_linkage.o -L/data/data/com.termux/files/usr/lib -Lbuild/temp.linux-aarch64-cpython-311 -lm -lpython3.11 -llibsvm-skl -lliblinear-skl -o build/lib.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_linkage.cpython-311.so -fopenmp
  building 'sklearn.cluster._hdbscan._reachability' extension
  clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/data/data/com.termux/files/usr/tmp/pip-build-env-bmci7imq/overlay/lib/python3.11/site-packages/numpy/_core/include -I/data/data/com.termux/files/usr/include/python3.11 -c sklearn/cluster/_hdbscan/_reachability.c -o build/temp.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_reachability.o -g0 -O2 -fopenmp
  clang -shared -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -fno-openmp-implicit-rpath -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r26b-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 -fno-openmp-implicit-rpath -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r26b-api-24-v4/sysroot/usr/lib -lm -lpython3.11 -llog build/temp.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_reachability.o -L/data/data/com.termux/files/usr/lib -Lbuild/temp.linux-aarch64-cpython-311 -lm -lpython3.11 -llibsvm-skl -lliblinear-skl -o build/lib.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_reachability.cpython-311.so -fopenmp
  building 'sklearn.cluster._hdbscan._tree' extension
  clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/data/data/com.termux/files/usr/tmp/pip-build-env-bmci7imq/overlay/lib/python3.11/site-packages/numpy/_core/include -I/data/data/com.termux/files/usr/include/python3.11 -c sklearn/cluster/_hdbscan/_tree.c -o build/temp.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_tree.o -g0 -O2 -fopenmp
  sklearn/cluster/_hdbscan/_tree.c:5217:63: warning: unused function '__pyx_convert__from_py___pyx_t_7sklearn_7cluster_8_hdbscan_5_tree_HIERARCHY_t' [-Wunused-function]
   5217 | static __pyx_t_7sklearn_7cluster_8_hdbscan_5_tree_HIERARCHY_t __pyx_convert__from_py___pyx_t_7sklearn_7cluster_8_hdbscan_5_tree_HIERARCHY_t(PyObject *__pyx_v_obj) {
        |                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 warning generated.
  clang -shared -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -fno-openmp-implicit-rpath -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r26b-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 -fno-openmp-implicit-rpath -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r26b-api-24-v4/sysroot/usr/lib -lm -lpython3.11 -llog build/temp.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_tree.o -L/data/data/com.termux/files/usr/lib -Lbuild/temp.linux-aarch64-cpython-311 -lm -lpython3.11 -llibsvm-skl -lliblinear-skl -o build/lib.linux-aarch64-cpython-311/sklearn/cluster/_hdbscan/_tree.cpython-311.so -fopenmp
  building 'sklearn.datasets._svmlight_format_fast' extension
  creating build/temp.linux-aarch64-cpython-311/sklearn/datasets
  clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/data/data/com.termux/files/usr/tmp/pip-build-env-bmci7imq/overlay/lib/python3.11/site-packages/numpy/_core/include -I/data/data/com.termux/files/usr/include/python3.11 -c sklearn/datasets/_svmlight_format_fast.c -o build/temp.linux-aarch64-cpython-311/sklearn/datasets/_svmlight_format_fast.o -g0 -O2 -fopenmp
...
Successfully installed scikit-learn-1.4.2

So smth new (a new build process: meson instead of clang, methinks) was introduced thereafter. It is only that single ver file that meson claims to be missing there, easy to recreate by my patch, if one knows it.

Manamama commented 2 months ago

Update - in parallel I have done "can you do pip cache remove numpy and pip cache remove scipy and rerun pip install scikit-learn -v" . I paste only the key segments :

  Successfully installed Cython-3.0.10 meson-1.4.1 meson-python-0.16.0 packaging-24.1 pyproject-metadata-0.8.0
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Running command Getting requirements to build wheel
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Running command Preparing metadata (pyproject.toml)
    + /data/data/com.termux/files/usr/bin/python3.11 /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd/vendored-meson/meson/meson.py setup /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd/.mesonpy-fg9o8o91 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd/.mesonpy-fg9o8o91/meson-python-native-file.ini
    The Meson build system
    Version: 1.2.99
    Source dir: /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd
    Build dir: /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd/.mesonpy-fg9o8o91
    Build type: native build
    Project name: NumPy
    Project version: 2.0.0
    C compiler for the host machine: clang (clang 18.1.8 "clang version 18.1.8")
    C linker for the host machine: clang ld.lld 18.1.8
    C++ compiler for the host machine: clang++ (clang 18.1.8 "clang version 18.1.8")
    C++ linker for the host machine: clang++ ld.lld 18.1.8
    Cython compiler for the host machine: cython (cython 3.0.10)
    Host machine cpu family: aarch64
    Host machine cpu: aarch64
    Program python found: YES (/data/data/com.termux/files/usr/bin/python3.11)
    Found pkg-config: /data/data/com.termux/files/usr/bin/pkg-config (0.29.2)
    Run-time dependency python found: YES 3.11
    Has header "Python.h" with dependency python-3.11: YES
    Compiler for C supports arguments -fno-strict-aliasing: YES
    Compiler for C supports arguments -ftrapping-math: YES
    Message: During parsing cpu-dispatch: The following CPU features were ignored due to platform incompatibility or lack of support:
    "XOP FMA4"
    Test features "NEON NEON_FP16 NEON_VFPV4 ASIMD" : Supported
    Test features "ASIMDHP" : Supported
    Test features "ASIMDFHM" : Supported
    Test features "SVE" : Supported
    Configuring npy_cpu_dispatch_config.h using configuration
    Message:
    CPU Optimization Options
      baseline:
        Requested : min
        Enabled   : NEON NEON_FP16 NEON_VFPV4 ASIMD
      dispatch:
        Requested : max -xop -fma4
        Enabled   : ASIMDHP ASIMDFHM SVE

    Library m found: YES
    Run-time dependency scipy-openblas found: NO (tried pkgconfig)
    Run-time dependency openblas found: YES 0.3.27
    Message: BLAS symbol suffix:
    Run-time dependency openblas found: YES 0.3.27
    Program _build_utils/process_src_template.py found: YES (/data/data/com.termux/files/usr/bin/python3.11 /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd/numpy/_build_utils/process_src_template.py)
    Program _build_utils/tempita.py found: YES (/data/data/com.termux/files/usr/bin/python3.11 /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd/numpy/_build_utils/tempita.py)
    Configuring __config__.py using configuration
    Checking for size of "short" : 2
....
   Generating multi-targets for "_simd.dispatch.h"
      Enabled targets: baseline
    Build targets in project: 64

    NumPy 2.0.0

      User defined options
        Native files: /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/numpy_f1dc556d0a81475c9d80c98772e5e9cd/.mesonpy-fg9o8o91/meson-python-native-file.ini
        buildtype   : release
        b_ndebug    : if-release
        b_vscrt     : md

    Found samurai-1.9 at /data/data/com.termux/files/usr/bin/samu
    + /data/data/com.termux/files/usr/bin/samu
    [1/322] Generating numpy/random/_bounded_integer_pyx with a custom command
    [2/322] Generating numpy/random/mtrand.pyx with a custom command
    [3/322] Generating numpy/random/_generator.pyx with a custom command
    [4/322] Generating numpy/random/_bounded_integer_pxd with a custom command
    [5/322] Generating numpy/random/c_distributions.pxd with a custom command
 ... 

but then it errors at :

    Host machine cpu: aarch64
    Program python found: YES (/data/data/com.termux/files/usr/bin/python3.11)
    Found pkg-config: YES (/data/data/com.termux/files/usr/bin/pkg-config) 0.29.2
    Run-time dependency python found: YES 3.11
    Program cython found: YES (/data/data/com.termux/files/usr/tmp/pip-build-env-ye9yeqhf/overlay/bin/cython)
    Compiler for C supports arguments -Wno-unused-but-set-variable: YES
    Compiler for C supports arguments -Wno-unused-function: YES
    Compiler for C supports arguments -Wno-conversion: YES
    Compiler for C supports arguments -Wno-misleading-indentation: YES
    Library m found: YES

    ../meson.build:84:0: ERROR: Value "legacy" (of type "string") for combo option "Fortran language standard to use" is not one of the choices. Possible choices are (as string): "none".

    A full log can be found at /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/scipy_857840d73d0b4c6aaa63f62397d5a8ff/.mesonpy-aza_ki0y/meson-logs/meson-log.txt
    error: subprocess-exited-with-error

    × Preparing metadata (pyproject.toml) 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.
    full command: /data/data/com.termux/files/usr/bin/python3.11 /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /data/data/com.termux/files/usr/tmp/tmpymknghke
    cwd: /data/data/com.termux/files/usr/tmp/pip-install-x6j6ke_t/scipy_857840d73d0b4c6aaa63f62397d5a8ff
    Preparing metadata (pyproject.toml): finished with status 'error'
  error: metadata-generation-failed

  × Encountered error while generating package metadata.
  ╰─> See above for output.

  note: This is an issue with the package mentioned above, not pip.
  hint: See above for details.
  error: subprocess-exited-with-error

I know how to fix it (just changing this legacy bit there, or sometimes export FC=gfortran works), but it explains whence this cached scipy etc that I had before - I had also git cloned, fixed etc. beforehand.

Now, after some such "behind the scenes" fixes:

  Compiler for Fortran supports arguments -w: YES (cached)
    Build targets in project: 197

    scipy 1.14.0

      User defined options
        Native files: /data/data/com.termux/files/usr/tmp/pip-install-45za4tde/scipy_7dcf051b7dc34d2680adfd8d658b091e/.mesonpy-rurfipq8/meson-python-native-file.ini
        buildtype   : release
        b_ndebug    : if-release
        b_vscrt     : md

    Found samurai-1.9 at /data/data/com.termux/files/usr/bin/samu
    + /data/data/com.termux/files/usr/bin/samu
    [1/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_interfaces_highs_c_api.cpp.o
    [2/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_stringutil.cpp.o
    [3/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_HVectorBase.cpp.o
    [4/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_HSet.cpp.o
    [5/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_HighsUtils.cpp.o
    [6/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_HighsSparseMatrix.cpp.o
    [7/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_HighsSort.cpp.o
    [8/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_HighsMatrixUtils.cpp.o
    [9/1353] Compiling C++ object scipy/optimize/_highs/libhighs.a.p/.._..__lib_highs_src_util_HighsMatrixPic.cpp.o
...

and it fails with the same error, so fully reproducible at my box:

 Running command Preparing metadata (pyproject.toml)
  + meson setup /data/data/com.termux/files/usr/tmp/pip-install-kdwdqedn/scikit-learn_3a9fffcdd0d74a13bd5c34be996319c2 /data/data/com.termux/files/usr/tmp/pip-install-kdwdqedn/scikit-learn_3a9fffcdd0d74a13bd5c34be996319c2/.mesonpy-gqwq8axg -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/data/data/com.termux/files/usr/tmp/pip-install-kdwdqedn/scikit-learn_3a9fffcdd0d74a13bd5c34be996319c2/.mesonpy-gqwq8axg/meson-python-native-file.ini
  The Meson build system
  Version: 1.4.1
  Source dir: /data/data/com.termux/files/usr/tmp/pip-install-kdwdqedn/scikit-learn_3a9fffcdd0d74a13bd5c34be996319c2
  Build dir: /data/data/com.termux/files/usr/tmp/pip-install-kdwdqedn/scikit-learn_3a9fffcdd0d74a13bd5c34be996319c2/.mesonpy-gqwq8axg
  Build type: native build

  ../meson.build:4:11: ERROR: Could not execute command `/usr/bin/env python /data/data/com.termux/files/usr/tmp/pip-install-kdwdqedn/scikit-learn_3a9fffcdd0d74a13bd5c34be996319c2/sklearn/_build_utils/version.py`.
lesteve commented 2 months ago

OK thanks for the additional details, so it seems like you are compiling numpy, scipy and scikit-learn from source. At least this is not something problematic with scikit-learn wheels.

To be honest to be more useful, someone should try to look into Termux to see if they can reproduce the issue. In the mean time your work-around is perfectly fine I guess, although I don't really understand it. The file should be here when you git clone the repo in your original attempt.

I am going to set this to "low-priority" since this probably does not affect too many users, at least this is the first time I hear about trying to install scikit-learn from source in Termux.

Searching a bit it seems like there are some projects that provides wheels for Termux, but only numpy and scipy right now: https://github.com/termux-user-repository/tur/

Searching a bit more, it seems people compile everything from source inside Termux looking at https://github.com/search?q=repo%3Atermux%2Ftermux-packages+sklearn&type=issues.

I am still interested by your use case :wink: to understand the context and motivations. I understand scikit-learn is a dependency of a number some other packages but what is your end goal? Random possibilities:

Manamama commented 2 months ago

It is out of scope for this bug, but since you ask:

lesteve commented 2 months ago

So I got curious enough to try Termux out and to be honest let's call this an interesting but not the most pleasant experience :sweat_smile:.

I am going to close this issue since I can not reproduce the OP problem. @Manamama I guess if the patch works for you, good enough ...

The approach I took, install as many things as I could with pkg for example numpy, scipy, ninja, something like:

pkg install python-numpy python-scipy ninja

Install the rest of the required build dependencies:

pip install cython meson-python

Build with --no-build-isolation to use system numpy and scipy rather than recompiling from source:

pip install scikit-learn -v --no-build-isolation

This builds fine on my phone and import sklearn works fine. Running the tests with pytest showed 2 failures which I am not going to investigate ...

Some caveats I bumped into, I guess regular Termux users may be aware of them:

Manamama commented 2 months ago

Thank you for trying so long to replicate it and closing it, @lesteve . My report was a FYI fix in fact, so that other scikit-learn & Termux🤳 or other non-standard👾 Linux users may stumble👁️ upon that patch, if needed. Ciao! 🐙

lesteve commented 2 months ago

I bumped into a similar build error when working on something completely unrelated. I believe #29415 should fix it.

In other words this patch should be good enough:

diff --git a/sklearn/_build_utils/version.py b/sklearn/_build_utils/version.py
index 49a3cfb82b..124c6cc3a0 100644
--- a/sklearn/_build_utils/version.py
+++ b/sklearn/_build_utils/version.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """Extract version number from __init__.py"""

 import os