Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: cuml-cpu: enable conda import tests, update scikit-learn and hdbscan to match cuml #6400

Draft
wants to merge 5 commits into
base: branch-25.04
Choose a base branch
from

Conversation

jameslamb
Copy link
Member

@jameslamb jameslamb commented Mar 5, 2025

Fixes #6403

This project publishes a conda package, cuml-cpu, which does what it sounds like... allows the use of cuML on systems without a GPU.

This proposes some updates to packaging for cuml-cpu:

  • enables import tests during conda builds
  • updates scikit-learn and hdbscan dependencies to match cuml
  • adds missing runtime dependency on packaging

Notes for Reviewers

Benefits of these Changes

This adds a bit of test coverage in CI, minimally verifying that cuml-cpu is installable an that import cuml works in an environment without a GPU.

Inspired by:

It also fixes some potential user-facing bugs.

How I tested this

@jameslamb jameslamb added 2 - In Progress Currenty a work in progress improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Mar 5, 2025

This comment was marked as resolved.

@github-actions github-actions bot added conda conda issue ci labels Mar 5, 2025
Comment on lines +36 to +37
- scikit-learn=1.5.*
- hdbscan>=0.8.39,<0.8.40
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes make cuml-cpu match the versions cuml is tested against.

- &scikit_learn scikit-learn==1.5.*

- hdbscan>=0.8.39,<0.8.40

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And might help with #6340

# version
RAPIDS_CUDA_MAJOR="${RAPIDS_CUDA_VERSION%%.*}"
if [[ ${RAPIDS_CUDA_MAJOR} == "11" ]]; then
if [[ ${RAPIDS_CUDA_MAJOR} == "12" ]]; then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One less thing to change in a possible future where this project drops CUDA 11 support. This isn't strictly necessary for this PR but seemed small enough that it'd be ok to include here... let me know if you'd like it removed.

@jameslamb jameslamb changed the title WIP: cuml-cpu: enable conda import tests, update dependencies to match cuml WIP: cuml-cpu: enable conda import tests, update scikit-learn and hdbscan to match cuml Mar 6, 2025
@@ -32,15 +32,17 @@ requirements:
run:
- python x.x
- numpy>=1.23,<3.0a0
- packaging
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 these import tests caught a bug!

    from cuml.internals.device_support import GPU_ENABLED
  File "device_support.pyx", line 18, in init cuml.internals.device_support
ModuleNotFoundError: No module named 'packaging'
WARNING: Tests failed for cuml-cpu-25.04.00a95-py310_250306_g2c8f9071e_95.conda - moving package to /opt/conda/conda-bld/broken

(build link)

cuml and cuml-cpu have a hard runtime dependency on packaging, from stuff like this:

from packaging.version import Version

but don't declare that in conda packages.

The wheels do correctly declare it:

"packaging",

- pandas
- scikit-learn=1.2
- hdbscan>=0.8.38,<0.8.39
- scikit-learn=1.5.*
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This revealed a significant problem... the latest Python that conda-forge's scikit-learn 1.2 supports is Python 3.11: https://anaconda.org/conda-forge/scikit-learn/files?version=1.2.2

So this scikit-learn=1.2 pin could cause issues for users trying to install cuml-cpu on Python 3.12 or later.

Reproducible example:

docker run \
    --rm \
    -it rapidsai/ci-conda \
    bash

conda create \
    --yes \
    --name cuml-test \
    'cuml-cpu==25.4.*' \
    'python=3.12'
LibMambaUnsatisfiableError: Encountered problems while solving:
  - package cuml-cpu-25.04.00a80-py312_250227_g4e4f7d89e_80 requires scikit-learn 1.2.*, but none of the providers can be installed

Could not solve for environment specs
The following packages are incompatible
├─ cuml-cpu =25.4 * is installable with the potential options
│  ├─ cuml-cpu [25.04.00a80|25.04.00a81|...|25.04.00a93] would require
│  │  └─ python_abi =3.10 *_cp310, which can be installed;
│  ├─ cuml-cpu [25.04.00a80|25.04.00a81|...|25.04.00a93] would require
│  │  └─ python_abi =3.11 *_cp311, which can be installed;
│  └─ cuml-cpu [25.04.00a80|25.04.00a81|...|25.04.00a93] would require
│     └─ scikit-learn =1.2 * with the potential options
│        ├─ scikit-learn [1.2.0|1.2.1|1.2.2] would require
│        │  └─ python_abi =3.10 *_cp310, which can be installed;
│        ├─ scikit-learn [1.2.0|1.2.1|1.2.2] would require
│        │  └─ python_abi =3.11 *_cp311, which can be installed;
│        ├─ scikit-learn [1.2.0|1.2.1|1.2.2] would require
│        │  └─ python_abi =3.8 *_cp38, which can be installed;
│        └─ scikit-learn [1.2.0|1.2.1|1.2.2] would require
│           └─ python_abi =3.9 *_cp39, which can be installed;
└─ python =3.12 * is not installable because it requires
   └─ python_abi =3.12 *_cp312, which conflicts with any installable versions previously reported.

@github-actions github-actions bot added the Cython / Python Cython or Python issue label Mar 7, 2025
@jameslamb
Copy link
Member Author

/ok to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - In Progress Currenty a work in progress ci conda conda issue Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] cuml-cpu fails to import without a GPU present
1 participant