pydantic / pydantic-core

Core validation logic for pydantic written in rust
MIT License
1.41k stars 236 forks source link

Fail to build pydantic_core on Termux Android with Python 3.11.10 #1474

Open slavikfoxy opened 2 weeks ago

slavikfoxy commented 2 weeks ago

~/MyProject $ pip install pydantic Collecting pydantic Downloading pydantic-2.9.2-py3-none-any.whl.metadata (149 kB) Collecting annotated-types>=0.6.0 (from pydantic) Downloading annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB) Collecting pydantic-core==2.23.4 (from pydantic) Downloading pydantic_core-2.23.4.tar.gz (402 kB) Installing build dependencies ... error error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> [53 lines of output] Collecting maturin<2,>=1 Using cached maturin-1.7.4.tar.gz (191 kB) 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' Collecting typing-extensions!=4.7.0,>=4.6.0 Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB) Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB) Building wheels for collected packages: maturin Building wheel for maturin (pyproject.toml): started Building wheel for maturin (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error

    × Building wheel for maturin (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [28 lines of output]
        running bdist_wheel
        running build
        running build_py
        creating build/lib.linux-aarch64-cpython-311/maturin
        copying maturin/__init__.py -> build/lib.linux-aarch64-cpython-311/maturin
        copying maturin/__main__.py -> build/lib.linux-aarch64-cpython-311/maturin
        running egg_info
        writing maturin.egg-info/PKG-INFO
        writing dependency_links to maturin.egg-info/dependency_links.txt
        writing requirements to maturin.egg-info/requires.txt
        writing top-level names to maturin.egg-info/top_level.txt
        reading manifest file 'maturin.egg-info/SOURCES.txt'
        reading manifest template 'MANIFEST.in'
        warning: no files found matching '*.json' under directory 'src/python_interpreter'
        writing manifest file 'maturin.egg-info/SOURCES.txt'
        running build_ext
        running build_rust
        error: can't find Rust compiler

        If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

        To update pip, run:

            pip install --upgrade pip

        and then retry package installation.

        If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for maturin
  Failed to build maturin
  ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (maturin)
  [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.

davidhewitt commented 2 weeks ago

error: can't find Rust compiler

Have you attempted to install Rust onto your system?

Also cc @messense looks like maturin isn't distributed as a binary for Android?

slavikfoxy commented 2 weeks ago

error: can't find Rust compiler

Have you attempted to install Rust onto your system?

Also cc @messense looks like maturin isn't distributed as a binary for Android?

hello, I tried to install Rust, but it also does not install. $ pip install rust Collecting rust Using cached RUST-1.3.1-py3-none-any.whl.metadata (762 bytes) Collecting pysam (from rust) Using cached pysam-0.22.1.tar.gz (4.6 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting matplotlib (from rust) Using cached matplotlib-3.9.2.tar.gz (36.1 MB) Installing build dependencies ... error error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> [98 lines of output] Collecting meson-python>=0.13.1 Using cached meson_python-0.16.0-py3-none-any.whl.metadata (4.1 kB) Collecting pybind11>=2.6 Using cached pybind11-2.13.6-py3-none-any.whl.metadata (9.5 kB) Collecting setuptools_scm>=7 Using cached setuptools_scm-8.1.0-py3-none-any.whl.metadata (6.6 kB) Collecting numpy<2.3,>=2.0.0rc1 Using cached numpy-2.1.1.tar.gz (18.9 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' Installing backend dependencies: started Installing backend dependencies: still running... Installing backend dependencies: finished with status 'error' error: subprocess-exited-with-error

    × pip subprocess to install backend dependencies did not run successfully.
    │ exit code: 1
    ╰─> [68 lines of output]
        Collecting ninja>=1.8.2
          Using cached ninja-1.11.1.1.tar.gz (132 kB)
          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'
        Collecting patchelf>=0.11.0
          Using cached patchelf-0.17.2.1.tar.gz (167 kB)
          Installing build dependencies: started
          Installing build dependencies: still running...
          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'
        Building wheels for collected packages: ninja, patchelf
          Building wheel for ninja (pyproject.toml): started
          Building wheel for ninja (pyproject.toml): finished with status 'error'
          error: subprocess-exited-with-error

          × Building wheel for ninja (pyproject.toml) did not run successfully.
          │ exit code: 1
          ╰─> [15 lines of output]
              /data/data/com.termux/files/usr/tmp/pip-build-env-yn2ezaf5/overlay/lib/python3.11/site-packages/setuptools_scm/git.py:312: UserWarning: git archive did not support describe output
                warnings.warn("git archive did not support describe output")
              /data/data/com.termux/files/usr/tmp/pip-build-env-yn2ezaf5/overlay/lib/python3.11/site-packages/setuptools_scm/git.py:331: UserWarning: unprocessed git archival found (no export subst applied)
                warnings.warn("unprocessed git archival found (no export subst applied)")
              Traceback (most recent call last):
                File "/data/data/com.termux/files/usr/tmp/pip-build-env-yn2ezaf5/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 639, in setup
                  cmkr = cmaker.CMaker(cmake_executable)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/data/data/com.termux/files/usr/tmp/pip-build-env-yn2ezaf5/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 145, in __init__
                  self.cmake_version = get_cmake_version(self.cmake_executable)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/data/data/com.termux/files/usr/tmp/pip-build-env-yn2ezaf5/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 102, in get_cmake_version
                  raise SKBuildError(msg) from err

              Problem with the CMake installation, aborting build. CMake executable is cmake
              [end of output]

          note: This error originates from a subprocess, and is likely not a problem with pip.
          ERROR: Failed building wheel for ninja
          Building wheel for patchelf (pyproject.toml): started
          Building wheel for patchelf (pyproject.toml): finished with status 'error'
          error: subprocess-exited-with-error

          × Building wheel for patchelf (pyproject.toml) did not run successfully.
          │ exit code: 1
          ╰─> [11 lines of output]
              Traceback (most recent call last):
                File "/data/data/com.termux/files/usr/tmp/pip-build-env-e1hokjsn/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 639, in setup
                  cmkr = cmaker.CMaker(cmake_executable)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/data/data/com.termux/files/usr/tmp/pip-build-env-e1hokjsn/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 145, in __init__
                  self.cmake_version = get_cmake_version(self.cmake_executable)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/data/data/com.termux/files/usr/tmp/pip-build-env-e1hokjsn/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 102, in get_cmake_version
                  raise SKBuildError(msg) from err

              Problem with the CMake installation, aborting build. CMake executable is cmake
              [end of output]

          note: This error originates from a subprocess, and is likely not a problem with pip.
          ERROR: Failed building wheel for patchelf
        Failed to build ninja patchelf
        ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (ninja, patchelf)
        [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 backend 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.
  [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.

davidhewitt commented 2 weeks ago

I don't think you will be able to install Rust through pip, that looks like a completely unrelated package. Try something like this:

https://www.geeksforgeeks.org/how-to-install-rust-on-termux/

slavikfoxy commented 2 weeks ago

oh, I didn't notice that I wrote pip instead of pkg. Ok, I installed rust but still can't install pydantic. $ pkg install rust rust is already the newest version (1.81.0-1). Summary: Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 5

But I couldn't get the rustc version, looks like I won't be able to install it on Termux. https://github.com/termux/termux-packages/issues/12039

irhamdz commented 2 weeks ago

same issue here

davidhewitt commented 2 weeks ago

If you cannot get the rustc version then it sounds like this is an upstream Termux issue.

rfsbraz commented 1 week ago

Can confirm the same issue when running my actions: https://github.com/rfsbraz/deleterr/actions/runs/11269028300/job/31336847605

davidhewitt commented 1 week ago

@rfsbraz that looks like a separate issue, you are building for alpine. There's a prebuilt wheel available for that platform so it should be possible to debug why that's not being installed.