kubeflow / pipelines

Machine Learning Pipelines for Kubeflow
https://www.kubeflow.org/docs/components/pipelines/
Apache License 2.0
3.62k stars 1.63k forks source link

[sdk] `libcst` dev setup issues with Python >=3.12 #11398

Open tumido opened 3 days ago

tumido commented 3 days ago

There's a problem with dev setup using Python 3.12 and newer.

A transitive dependency libcst is required to be present in following version range: libcst<0.5.0,>=0.3.10. This correctly resolves to 0.4.10 release, however it becomes an issue for Python 3.12, since libcst has no prebuilt wheels for these Python versions (this libcst version is simply too old).

This means pip tries to build libcst from scratch, which required Rust toolchain to be present on the system. This is not documented in the CONTRIBUTING.md.

I think KFP either needs to update its dependencies so it can resolve newer libcst or include a notice to provide Rust toolchain on system, if developing against Python 3.12 and newer.

Environment

Fresh setup of dev environment from current master

Steps to reproduce

  1. Use Python >=3.12
  2. Follow sdk/CONTRIBUTING.md
  3. See Python 3.12 and 3.13 is supported in sdk/python/setup.py
  4. Run pip install -r sdk/python/requirements-dev.txt

Current result

...
Collecting libcst<0.5.0,>=0.3.10 (from pycln==2.1.1->-r sdk/python/requirements-dev.txt (line 8))
...
Building wheels for collected packages: libcst
  Building wheel for libcst (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for libcst (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [386 lines of output]
      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 libcst
Failed to build libcst
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (libcst)

Expected result

Packages install just fine.

Materials and Reference

https://pypi.org/project/libcst/0.4.10/#files


Impacted by this bug? Give it a 👍.