Skip to content

nnunetv2 support for numpy >=2.0 #1986

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

Open
KumoLiu opened this issue May 2, 2025 · 1 comment
Open

nnunetv2 support for numpy >=2.0 #1986

KumoLiu opened this issue May 2, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@KumoLiu
Copy link
Contributor

KumoLiu commented May 2, 2025

[2025-05-01T13:49:17.542Z] + python -m tests.integration.test_integration_nnunetv2_runner

[2025-05-01T13:49:18.474Z] 

[2025-05-01T13:49:18.474Z] A module that was compiled using NumPy 1.x cannot be run in

[2025-05-01T13:49:18.474Z] NumPy 2.2.5 as it may crash. To support both 1.x and 2.x

[2025-05-01T13:49:18.474Z] versions of NumPy, modules must be compiled with NumPy 2.0.

[2025-05-01T13:49:18.474Z] Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

[2025-05-01T13:49:18.474Z] 

[2025-05-01T13:49:18.474Z] If you are a user of the module, the easiest solution will be to

[2025-05-01T13:49:18.474Z] downgrade to 'numpy<2' or try to upgrade the affected module.

[2025-05-01T13:49:18.474Z] We expect that some modules will need time to support NumPy 2.

[2025-05-01T13:49:18.474Z] 

[2025-05-01T13:49:18.474Z] Traceback (most recent call last):  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main

[2025-05-01T13:49:18.474Z]     return _run_code(code, main_globals, None,

[2025-05-01T13:49:18.474Z]   File "/usr/lib/python3.10/runpy.py", line 86, in _run_code

[2025-05-01T13:49:18.474Z]     exec(code, run_globals)

[2025-05-01T13:49:18.474Z]   File "/home/jenkins/agent/workspace/Monai-notebooks/MONAI/tests/integration/test_integration_nnunetv2_runner.py", line 21, in <module>

[2025-05-01T13:49:18.474Z]     from monai.apps.nnunet import nnUNetV2Runner

[2025-05-01T13:49:18.474Z]   File "/home/jenkins/agent/workspace/Monai-notebooks/MONAI/monai/__init__.py", line 83, in <module>

[2025-05-01T13:49:18.474Z]     from .utils.module import load_submodules  # noqa: E402

[2025-05-01T13:49:18.474Z]   File "/home/jenkins/agent/workspace/Monai-notebooks/MONAI/monai/utils/__init__.py", line 16, in <module>

[2025-05-01T13:49:18.474Z]     from .deprecate_utils import DeprecatedError, deprecated, deprecated_arg, deprecated_arg_default

[2025-05-01T13:49:18.474Z]   File "/home/jenkins/agent/workspace/Monai-notebooks/MONAI/monai/utils/deprecate_utils.py", line 22, in <module>

[2025-05-01T13:49:18.474Z]     from monai.utils.module import version_leq

[2025-05-01T13:49:18.474Z]   File "/home/jenkins/agent/workspace/Monai-notebooks/MONAI/monai/utils/module.py", line 30, in <module>

[2025-05-01T13:49:18.474Z]     import torch

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/__init__.py", line 2479, in <module>

[2025-05-01T13:49:18.474Z]     from torch import (

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/export/__init__.py", line 64, in <module>

[2025-05-01T13:49:18.474Z]     from .dynamic_shapes import Constraint, Dim, dims, ShapesCollection

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/export/dynamic_shapes.py", line 22, in <module>

[2025-05-01T13:49:18.474Z]     from .exported_program import ExportedProgram

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/export/exported_program.py", line 27, in <module>

[2025-05-01T13:49:18.474Z]     from torch._higher_order_ops.utils import autograd_not_implemented

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/_higher_order_ops/__init__.py", line 1, in <module>

[2025-05-01T13:49:18.474Z]     from torch._higher_order_ops.cond import cond

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/_higher_order_ops/cond.py", line 6, in <module>

[2025-05-01T13:49:18.474Z]     import torch._subclasses.functional_tensor

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/_subclasses/functional_tensor.py", line 44, in <module>

[2025-05-01T13:49:18.474Z]     class FunctionalTensor(torch.Tensor):

[2025-05-01T13:49:18.474Z]   File "/usr/local/lib/python3.10/dist-packages/torch/_subclasses/functional_tensor.py", line 271, in FunctionalTensor

[2025-05-01T13:49:18.474Z]     cpu = _conversion_method_template(device=torch.device("cpu"))

[2025-05-01T13:49:18.474Z] /usr/local/lib/python3.10/dist-packages/torch/_subclasses/functional_tensor.py:271: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /opt/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)

[2025-05-01T13:49:18.474Z]   cpu = _conversion_method_template(device=torch.device("cpu"))
@KumoLiu
Copy link
Contributor Author

KumoLiu commented May 7, 2025

Known issue here: MIC-DKFZ/nnUNet#2299

Will restricted the numpy version < 2.0 as a workaround for the ci now.

@KumoLiu KumoLiu added the bug Something isn't working label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant