Skip to content

Commit

Permalink
Remove NumPy <2 pin (#762)
Browse files Browse the repository at this point in the history
This PR removes the NumPy<2 pin which is expected to work for
RAPIDS projects once CuPy 13.3.0 is released (CuPy 13.2.0 had
some issues preventing the use with NumPy 2).

Authors:
  - Sebastian Berg (https://github.com/seberg)
  - https://github.com/jakirkham

Approvers:
  - James Lamb (https://github.com/jameslamb)
  - Gregory Lee (https://github.com/grlee77)
  - https://github.com/jakirkham

URL: #762
  • Loading branch information
seberg authored Aug 23, 2024
1 parent a59be4f commit 6796d6d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- matplotlib-base
- nbsphinx
- ninja
- numpy>=1.23.4,<2.0a0
- numpy>=1.23.4,<3.0a0
- numpydoc>=1.5
- nvcc_linux-64=11.8
- openslide-python>=1.3.0
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-125_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- matplotlib-base
- nbsphinx
- ninja
- numpy>=1.23.4,<2.0a0
- numpy>=1.23.4,<3.0a0
- numpydoc>=1.5
- openslide-python>=1.3.0
- pip
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cucim/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ requirements:
{% if cuda_major != "11" %}
- cuda-cudart
{% endif %}
- numpy >=1.23,<2.0a0
- numpy >=1.23,<3.0a0
- click
- cupy >=12.0.0
- lazy_loader >=0.1
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ dependencies:
packages:
- click
- lazy_loader>=0.1
- numpy>=1.23.4,<2.0a0
- numpy>=1.23.4,<3.0a0
- scikit-image>=0.19.0,<0.25.0a0
- scipy>=1.6.0
- output_types: conda
Expand Down
2 changes: 1 addition & 1 deletion python/cucim/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies = [
"click",
"cupy-cuda11x>=12.0.0",
"lazy_loader>=0.1",
"numpy>=1.23.4,<2.0a0",
"numpy>=1.23.4,<3.0a0",
"scikit-image>=0.19.0,<0.25.0a0",
"scipy>=1.6.0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
Expand Down
5 changes: 4 additions & 1 deletion python/cucim/src/cucim/skimage/color/colorconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1121,10 +1121,13 @@ def gray2rgba(image, alpha=None, *, channel_axis=-1, check_alpha=True):
_, alpha = dtype_limits(image, clip_negative=False)

if np.isscalar(alpha):
# Convert to NumPy. As of NumPy 2.1 (and cupy 13.3) `cp.full`
# will raise for out-of-bound Python integers otherwise.
alpha = np.asarray(alpha)
if check_alpha:
# do not use np.can_cast here for NumPy 2.0 compatibility
with np.errstate(over="ignore", under="ignore"):
alpha_cast = np.asarray(alpha).astype(image.dtype)
alpha_cast = alpha.astype(image.dtype)
if alpha_cast != alpha:
warn(
'alpha cannot be safely cast to image dtype '
Expand Down

0 comments on commit 6796d6d

Please sign in to comment.