Numpy 1.x compatibility fixes - #8118
Conversation
📝 WalkthroughWalkthroughThis PR raises the NumPy minimum to 1.26 across packaging and CI, implements NumPy 2.x-compatible dtype handling in validation (using dtype.kind and a np_asarray shim), updates CuPy array construction in linear solvers to align copy semantics, and adapts tests/skips accordingly. ChangesNumPy 1.26 minimum and 2.x compatibility
🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@dependencies.yaml`:
- Around line 533-534: The oldest-dep matrix currently lists a plain
`cupy==13.6` alongside outputs `[conda, requirements, pyproject]`; change that
entry so the plain `cupy==13.6` is emitted only for the conda output and not for
requirements/pyproject. In practice, modify the oldest-dep matrix (the block
that mirrors `depends_on_cupy`) to: emit `cupy==13.6` under the conda-only
output type, and remove the plain `cupy==13.6` from requirements/pyproject so
the CUDA-suffixed variants (handled by the existing `depends_on_cupy` logic) are
used for pip-based outputs. Ensure you reference the existing `depends_on_cupy`
pattern when making the change.
In `@python/cuml/cuml/internals/validation.py`:
- Around line 487-497: The np_asarray compatibility shim incorrectly forwards
order=None to np.array which breaks on NumPy 1.26; modify the np_asarray
function so it only includes the order keyword when order is not None (i.e.,
build the call to np.array with dtype and copy always, but conditionally add
order), preserving the existing conversion of copy to bool(copy) and behavior
differences across NumPy versions; this change will ensure check_array (and
callers passing order=None, mem_type="host") works on NumPy 1.x while keeping
the np_asarray name and semantics.
🪄 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: 1ec64afc-2861-4c24-bc72-b688d79b5746
📒 Files selected for processing (3)
dependencies.yamlpython/cuml/cuml/internals/validation.pypython/cuml/tests/explainer/test_gpu_treeshap.py
|
/merge |
This:
numpyversion to 1.26, to match that ofcudf. Sincecudfis a required dependency, we were effectively pinned at that already.numpyto our oldest deps test runs. This also effectively addscupy==13.6, sincecupy==14requiresnumpy>=2.0. Explicitly specifyingcupy==13.6in an oldest-deps run is tricky since the pypi packages require cuda suffixes as well. I'm skipping that for now.