Skip to content

Bump scikit-learn minimum to 1.6 - #8091

Merged
rapids-bot[bot] merged 11 commits into
NVIDIA:mainfrom
csadorf:csadorf/bump-sklearn-1.6
Jun 4, 2026
Merged

Bump scikit-learn minimum to 1.6#8091
rapids-bot[bot] merged 11 commits into
NVIDIA:mainfrom
csadorf:csadorf/bump-sklearn-1.6

Conversation

@csadorf

@csadorf csadorf commented May 12, 2026

Copy link
Copy Markdown
Contributor

Bumps scikit-learn minimum dependency from 1.5 to 1.6 across all environments, recipes, and pyproject.toml. Also updates the README and pytest_plugin docstrings to reflect the new version.

Closes #8098

@csadorf csadorf added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 12, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 12, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added conda conda issue Cython / Python Cython or Python issue labels May 12, 2026
@csadorf
csadorf force-pushed the csadorf/bump-sklearn-1.6 branch from cdd3245 to 61eded8 Compare May 13, 2026 14:44
@csadorf

This comment has been minimized.

@csadorf

This comment has been minimized.

@csadorf
csadorf force-pushed the csadorf/bump-sklearn-1.6 branch from e5f5323 to 777b6f8 Compare June 1, 2026 19:16
@csadorf

This comment has been minimized.

@csadorf
csadorf force-pushed the csadorf/bump-sklearn-1.6 branch from 777b6f8 to 8358f6f Compare June 1, 2026 20:58
@csadorf

This comment has been minimized.

@csadorf
csadorf force-pushed the csadorf/bump-sklearn-1.6 branch from 8358f6f to 7fd18dc Compare June 2, 2026 14:44
@csadorf

This comment has been minimized.

csadorf added 8 commits June 3, 2026 12:45
The README compatibility section and pytest_plugin docstrings
still referenced scikit-learn 1.4/1.5. Update them to reflect
the new minimum version of 1.6.

Files updated:
- README.md: compatible with scikit-learn version 1.4 → 1.6
- pytest_plugin.py: example conditions updated to >=1.6
@csadorf
csadorf force-pushed the csadorf/bump-sklearn-1.6 branch from 7fd18dc to 522b7de Compare June 3, 2026 12:45
@csadorf

This comment has been minimized.

@csadorf

This comment has been minimized.

@csadorf

csadorf commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

This is essentially ready for merge. I'm looking into ripping out the old tag infrastructure as part of this PR. If that turns out to be too tedious, we can split it off into a follow-up.

@csadorf

csadorf commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

This is essentially ready for merge. I'm looking into ripping out the old tag infrastructure as part of this PR. If that turns out to be too tedious, we can split it off into a follow-up.

We can handle the tags infrastructure in a follow-up: #8228

@csadorf
csadorf marked this pull request as ready for review June 3, 2026 22:22
@csadorf
csadorf requested review from a team as code owners June 3, 2026 22:22
@csadorf
csadorf requested review from bdice and jcrist June 3, 2026 22:22
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 15b33fae-a385-4e4c-9e78-88b2358324ac

📥 Commits

Reviewing files that changed from the base of the PR and between 88e0430 and 3fb38ef.

📒 Files selected for processing (1)
  • docs/source/supported_versions.rst

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Raised minimum scikit-learn requirement from 1.5 to 1.6 across build configs, dependency manifests, and package metadata.
  • Tests
    • Updated CI and test matrices to use scikit-learn 1.6 pins and added warning filters to suppress new scikit-learn 1.6 tag/deprecation warnings.
    • Adjusted test xfail conditions to match scikit-learn 1.6 behaviors.
  • Documentation
    • Updated supported-versions docs and README to require scikit-learn >=1.6.

Walkthrough

This PR raises cuML's minimum scikit-learn requirement to 1.6 across configs, adds a suppression context for sklearn 1.6 legacy-tag warnings (used for check_is_fitted and tag lookups), and updates pytest filters and test xfail conditions for sklearn 1.6.

Changes

scikit-learn 1.6 compatibility upgrade

Layer / File(s) Summary
Dependency version updates across configurations
README.md, conda/environments/all_cuda-129_arch-aarch64.yaml, conda/environments/all_cuda-129_arch-x86_64.yaml, conda/environments/all_cuda-132_arch-aarch64.yaml, conda/environments/all_cuda-132_arch-x86_64.yaml, conda/recipes/cuml/recipe.yaml, dependencies.yaml, python/cuml/pyproject.toml, docs/source/supported_versions.rst
README, environment YAMLs, conda recipe, dependency generator, CI pins, pyproject, and supported versions doc updated to require scikit-learn>=1.6.
sklearn legacy-tag warning suppression
python/cuml/cuml/internals/validation.py, python/cuml/cuml/explainer/common.py
Adds _suppress_sklearn_legacy_tag_warnings() context manager and redefines/uses check_is_fitted and tag lookups under that suppression to filter sklearn 1.6 tag-provider FutureWarnings.
Pytest filters and test compatibility adjustments
python/cuml/cuml/accel/pytest_plugin.py, python/cuml/pyproject.toml, python/cuml/cuml_accel_tests/upstream/pytest.ini, python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-list.yaml
Docstring version examples updated to 1.6, pytest filterwarnings extended to suppress sklearn 1.6 deprecations, and upstream xfail conditions adjusted to target sklearn 1.6 boundaries and specific failing tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • rapidsai/cuml#8029: This PR's changes to locally wrap check_is_fitted to suppress sklearn legacy tag FutureWarnings are related.

Suggested labels

sklearn-api-compat, ci

Suggested reviewers

  • betatim
  • jameslamb
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Bump scikit-learn minimum to 1.6' clearly and concisely summarizes the main change across all modified files in the changeset.
Description check ✅ Passed The description accurately explains that scikit-learn minimum dependency is bumped from 1.5 to 1.6 across all files and references the related issue.
Linked Issues check ✅ Passed The PR fully addresses linked issue #8098 by updating all dependency constraints to require scikit-learn>=1.6 and updating compatibility documentation.
Out of Scope Changes check ✅ Passed All changes are in-scope, focusing on scikit-learn 1.6 minimum requirement bump and related documentation updates; the wrapper function in validation.py supports the scikit-learn 1.6 compatibility requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cuml/cuml/internals/validation.py`:
- Around line 67-76: The wrapper _suppress_sklearn_legacy_tag_warnings currently
only ignores FutureWarning; update it to also ignore DeprecationWarning so
sklearn 1.6/1.7 legacy-tag deprecation messages are captured. In the
contextmanager that iterates _SKLEARN_LEGACY_TAG_WARNING_MESSAGES, change the
warnings.filterwarnings call to target both FutureWarning and DeprecationWarning
(e.g., pass a tuple of exception classes or apply a second filter) so both
warning types are suppressed for the listed messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 20400484-dfe4-427b-ba2f-821df8884cec

📥 Commits

Reviewing files that changed from the base of the PR and between e1b2740 and 88e0430.

📒 Files selected for processing (13)
  • README.md
  • conda/environments/all_cuda-129_arch-aarch64.yaml
  • conda/environments/all_cuda-129_arch-x86_64.yaml
  • conda/environments/all_cuda-132_arch-aarch64.yaml
  • conda/environments/all_cuda-132_arch-x86_64.yaml
  • conda/recipes/cuml/recipe.yaml
  • dependencies.yaml
  • python/cuml/cuml/accel/pytest_plugin.py
  • python/cuml/cuml/explainer/common.py
  • python/cuml/cuml/internals/validation.py
  • python/cuml/cuml_accel_tests/upstream/pytest.ini
  • python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-list.yaml
  • python/cuml/pyproject.toml

Comment on lines +67 to +76
@contextmanager
def _suppress_sklearn_legacy_tag_warnings():
with warnings.catch_warnings():
for message in _SKLEARN_LEGACY_TAG_WARNING_MESSAGES:
warnings.filterwarnings(
"ignore",
message=message,
category=FutureWarning,
)
yield

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

In scikit-learn 1.6 and 1.7 transition docs/changelog, are legacy tag warnings (_get_tags/_more_tags) always emitted as FutureWarning, or can they be DeprecationWarning depending on code path?

💡 Result:

In scikit-learn 1.6 and 1.7, warnings related to legacy tag methods (_get_tags, _more_tags, and _safe_tags) are consistently emitted as DeprecationWarning [1][2]. Initially, these warnings were introduced as FutureWarning, but they were explicitly changed to DeprecationWarning in scikit-learn 1.6 to ensure that the notifications are targeted at developers rather than end-users [1][3]. This change was implemented via PR #30573 to prevent end-users from being exposed to library-level deprecation messages that they generally cannot fix [3]. Consequently, there is no code path in scikit-learn 1.6 or 1.7 where these specific legacy tag methods continue to emit a FutureWarning; they are intended to be DeprecationWarning across all relevant paths [1][2]. As of scikit-learn 1.7, the old tag infrastructure was subject to further cleanup [4].

Citations:


Suppress sklearn legacy-tag deprecation warnings for both DeprecationWarning and FutureWarning

In python/cuml/cuml/internals/validation.py (lines 67-76), _suppress_sklearn_legacy_tag_warnings() filters only FutureWarning, but sklearn 1.6/1.7 legacy tag warnings are emitted as DeprecationWarning, so this wrapper can miss the messages.

Suggested patch
 `@contextmanager`
 def _suppress_sklearn_legacy_tag_warnings():
     with warnings.catch_warnings():
-        for message in _SKLEARN_LEGACY_TAG_WARNING_MESSAGES:
-            warnings.filterwarnings(
-                "ignore",
-                message=message,
-                category=FutureWarning,
-            )
+        for message in _SKLEARN_LEGACY_TAG_WARNING_MESSAGES:
+            for category in (FutureWarning, DeprecationWarning):
+                warnings.filterwarnings(
+                    "ignore",
+                    message=message,
+                    category=category,
+                )
         yield
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@contextmanager
def _suppress_sklearn_legacy_tag_warnings():
with warnings.catch_warnings():
for message in _SKLEARN_LEGACY_TAG_WARNING_MESSAGES:
warnings.filterwarnings(
"ignore",
message=message,
category=FutureWarning,
)
yield
`@contextmanager`
def _suppress_sklearn_legacy_tag_warnings():
with warnings.catch_warnings():
for message in _SKLEARN_LEGACY_TAG_WARNING_MESSAGES:
for category in (FutureWarning, DeprecationWarning):
warnings.filterwarnings(
"ignore",
message=message,
category=category,
)
yield
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/internals/validation.py` around lines 67 - 76, The wrapper
_suppress_sklearn_legacy_tag_warnings currently only ignores FutureWarning;
update it to also ignore DeprecationWarning so sklearn 1.6/1.7 legacy-tag
deprecation messages are captured. In the contextmanager that iterates
_SKLEARN_LEGACY_TAG_WARNING_MESSAGES, change the warnings.filterwarnings call to
target both FutureWarning and DeprecationWarning (e.g., pass a tuple of
exception classes or apply a second filter) so both warning types are suppressed
for the listed messages.

@jcrist jcrist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving, but with one comment and one question. Thanks for working on this!


def check_is_fitted(*args, **kwargs):
with _suppress_sklearn_legacy_tag_warnings():
return _sklearn_check_is_fitted(*args, **kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you comment on why we need to suppress the warnings here? I install sklearn 1.6 and can't seem to trigger an warning in check_is_fitted when called on our models.

IIUC this is a stop-gap in this PR that's then removed in #8227, so this code shouldn't be long lived. Mostly just curious why this showed up here and in what conditions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure why it doesn't trigger for you, but this code will emit the warning for 26.06 nightlies in combination with sklearn version 1.6:

from cuml.datasets import make_regression
from cuml.linear_model import LinearRegression


X, y = make_regression(n_samples=20, n_features=5, random_state=0)
LinearRegression().fit(X, y).predict(X)

import sklearn; assert sklearn.__version__ == "1.6.0"

This calls check_is_fitted() as part of the predict() call, and it can also be triggered by calling check_is_fitted() explicitly.

Either way, this is a very temporary compatibility shim. We can immediately remove it in the follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suspect we just had not explicitly tested with sklearn 1.6.0 previously which is probably why this hadn't come up before.


* **NumPy**: >=1.23,<3.0a0
* **scikit-learn**: >=1.5
* **scikit-learn**: >=1.6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Versions are also noted in the cuml-accel docs: https://github.com/rapidsai/cuml/blob/af109cb7e2bc8e62906d533aa098af8ae1474fe3/docs/source/cuml-accel/limitations.rst?plain=1#L50-L52

  • If you want to merge this PR as is and add the fixup in Update cuML sklearn tags for scikit-learn 1.6 #8227 that's fine
  • I wonder if we could make the doc in cuml-accel/limitations.rst point to supported_versions.rst to avoid having two places we need to check this? What we have now is also fine, no strong thoughts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's keep it separate for now and I'll fix this in the follow-up to avoid a CI cycle.

@jcrist

jcrist commented Jun 4, 2026

Copy link
Copy Markdown
Member

/merge

@rapids-bot
rapids-bot Bot merged commit 959c4c6 into NVIDIA:main Jun 4, 2026
102 checks passed
@csadorf
csadorf deleted the csadorf/bump-sklearn-1.6 branch June 4, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Require scikit-learn version 1.6

4 participants