Skip to content

AttributeError: module 'numpy' has no attribute 'bool' #1997

Open
@KumoLiu

Description

@KumoLiu
[2025-06-16T22:42:14.473Z] Running ./model_zoo/TCIA_PROSTATEx_Prostate_MRI_Anatomy_Model.ipynb
[2025-06-16T22:42:14.728Z] Running notebook...
[2025-06-16T22:42:22.802Z] In the future `np.bool` will be defined as the corresponding NumPy scalar.
[2025-06-16T22:42:22.802Z] In the future `np.bool` will be defined as the corresponding NumPy scalar.
[2025-06-16T22:42:22.802Z] In the future `np.bool` will be defined as the corresponding NumPy scalar.
[2025-06-16T22:42:24.685Z] MONAI version: 1.5.0
[2025-06-16T22:42:24.685Z] Numpy version: 1.26.4
[2025-06-16T22:42:24.685Z] Pytorch version: 2.6.0+cu124
[2025-06-16T22:42:24.685Z] MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
[2025-06-16T22:42:24.685Z] MONAI rev id: d388d1c6fec8cb3a0eebee5b5a0b9776ca59ca83
[2025-06-16T22:42:24.685Z] MONAI __file__: /home/jenkins/agent/workspace/Monai-notebooks/MONAI/monai/__init__.py
[2025-06-16T22:42:24.685Z] 
[2025-06-16T22:42:24.685Z] Optional dependencies:
[2025-06-16T22:42:24.685Z] In the future `np.bool` will be defined as the corresponding NumPy scalar.
[2025-06-16T22:42:24.941Z] Pytorch Ignite version: 0.4.11
[2025-06-16T22:42:24.941Z] ITK version: NOT INSTALLED or UNKNOWN VERSION.
[2025-06-16T22:42:24.941Z] Nibabel version: 5.3.2
[2025-06-16T22:42:24.941Z] scikit-image version: 0.25.2
[2025-06-16T22:42:24.941Z] scipy version: 1.14.0
[2025-06-16T22:42:24.941Z] Pillow version: 10.4.0
[2025-06-16T22:42:24.941Z] Tensorboard version: 2.16.2
[2025-06-16T22:42:24.941Z] gdown version: 5.2.0
[2025-06-16T22:42:24.941Z] TorchVision version: 0.21.0+cu124
[2025-06-16T22:42:24.941Z] tqdm version: 4.66.5
[2025-06-16T22:42:24.941Z] lmdb version: 1.6.2
[2025-06-16T22:42:24.941Z] psutil version: 6.0.0
[2025-06-16T22:42:24.941Z] pandas version: 2.2.2
[2025-06-16T22:42:24.941Z] einops version: 0.8.0
[2025-06-16T22:42:24.941Z] transformers version: 4.40.2
[2025-06-16T22:42:24.941Z] mlflow version: 3.1.0
[2025-06-16T22:42:24.941Z] pynrrd version: 1.1.3
[2025-06-16T22:42:24.941Z] clearml version: 2.0.0
[2025-06-16T22:42:24.941Z] 
[2025-06-16T22:42:24.941Z] For details about installing the optional dependencies, please visit:
[2025-06-16T22:42:24.941Z]     https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
[2025-06-16T22:42:24.941Z] 
[2025-06-16T22:42:27.448Z] papermill  --progress-bar --log-output -k python3
[2025-06-16T22:42:27.448Z] /usr/local/lib/python3.10/dist-packages/papermill/iorw.py:149: UserWarning: the file is not specified with any extension : -
[2025-06-16T22:42:27.448Z]   warnings.warn(f"the file is not specified with any extension : {os.path.basename(path)}")
[2025-06-16T22:43:36.231Z] 
Executing:   0%|          | 0/32 [00:00<?, ?cell/s]
Executing:   3%|▎         | 1/32 [00:00<00:29,  1.06cell/s]
Executing:  22%|██▏       | 7/32 [01:01<03:46,  9.08s/cell]
Executing:  28%|██▊       | 9/32 [01:01<02:28,  6.47s/cell]
Executing:  28%|██▊       | 9/32 [01:02<02:38,  6.90s/cell]
[2025-06-16T22:43:36.231Z] /usr/local/lib/python3.10/dist-packages/papermill/iorw.py:149: UserWarning: the file is not specified with any extension : -
[2025-06-16T22:43:36.231Z]   warnings.warn(f"the file is not specified with any extension : {os.path.basename(path)}")
[2025-06-16T22:43:36.231Z] Traceback (most recent call last):
[2025-06-16T22:43:36.231Z]   File "/usr/local/bin/papermill", line 8, in <module>
[2025-06-16T22:43:36.231Z]     sys.exit(papermill())
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in __call__
[2025-06-16T22:43:36.231Z]     return self.main(*args, **kwargs)
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
[2025-06-16T22:43:36.231Z]     rv = self.invoke(ctx)
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
[2025-06-16T22:43:36.231Z]     return ctx.invoke(self.callback, **ctx.params)
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
[2025-06-16T22:43:36.231Z]     return __callback(*args, **kwargs)
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 33, in new_func
[2025-06-16T22:43:36.231Z]     return f(get_current_context(), *args, **kwargs)
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/papermill/cli.py", line 235, in papermill
[2025-06-16T22:43:36.231Z]     execute_notebook(
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/papermill/execute.py", line 131, in execute_notebook
[2025-06-16T22:43:36.231Z]     raise_for_execution_errors(nb, output_path)
[2025-06-16T22:43:36.231Z]   File "/usr/local/lib/python3.10/dist-packages/papermill/execute.py", line 251, in raise_for_execution_errors
[2025-06-16T22:43:36.231Z]     raise error
[2025-06-16T22:43:36.231Z] papermill.exceptions.PapermillExecutionError: 
[2025-06-16T22:43:36.231Z] ---------------------------------------------------------------------------
[2025-06-16T22:43:36.231Z] Exception encountered at "In [2]":
[2025-06-16T22:43:36.231Z] ---------------------------------------------------------------------------
[2025-06-16T22:43:36.231Z] AttributeError                            Traceback (most recent call last)
[2025-06-16T22:43:36.231Z] Cell In[2], line 8
[2025-06-16T22:43:36.231Z]       5 import numpy as np
[2025-06-16T22:43:36.231Z]       7 # Include ITK for DICOM reading.
[2025-06-16T22:43:36.231Z] ----> 8 import itk
[2025-06-16T22:43:36.231Z]      10 # Include pydicom_seg for DICOM SEG objects
[2025-06-16T22:43:36.231Z]      11 import pydicom
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] File /usr/local/lib/python3.10/dist-packages/itk/__init__.py:28
[2025-06-16T22:43:36.231Z]      21 # Must import module from python path, not local reference
[2025-06-16T22:43:36.231Z]      22 # in order to maintain the singular value of the module values.
[2025-06-16T22:43:36.231Z]      23 # `import .conf.itkConfig` is a different context than
[2025-06-16T22:43:36.231Z]      24 # `import itkConfig`, even if they are the same file. The
[2025-06-16T22:43:36.231Z]      25 # LazyLoading and other values may be different in the two contexts.
[2025-06-16T22:43:36.231Z]      26 from itkConfig import ITK_GLOBAL_VERSION_STRING as __version__
[2025-06-16T22:43:36.231Z] ---> 28 from itk.support.extras import *
[2025-06-16T22:43:36.231Z]      29 from itk.support.init_helpers import *
[2025-06-16T22:43:36.231Z]      30 from itk.support.types import (
[2025-06-16T22:43:36.231Z]      31     itkCType,
[2025-06-16T22:43:36.231Z]      32     F,
[2025-06-16T22:43:36.231Z]    (...)
[2025-06-16T22:43:36.231Z]      48     OT,
[2025-06-16T22:43:36.231Z]      49 )
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] File /usr/local/lib/python3.10/dist-packages/itk/support/extras.py:37
[2025-06-16T22:43:36.231Z]      33 import builtins
[2025-06-16T22:43:36.231Z]      35 fileiotype = Union[str, bytes, os.PathLike]
[2025-06-16T22:43:36.231Z] ---> 37 import itk.support.types as itkt
[2025-06-16T22:43:36.231Z]      39 from .helpers import wasm_type_from_image_type, image_type_from_wasm_type
[2025-06-16T22:43:36.231Z]      40 from .helpers import wasm_type_from_mesh_type, mesh_type_from_wasm_type, python_to_js
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] File /usr/local/lib/python3.10/dist-packages/itk/support/types.py:178
[2025-06-16T22:43:36.231Z]     160 SLL: itkCType
[2025-06-16T22:43:36.231Z]     161 B: itkCType
[2025-06-16T22:43:36.231Z]     163 (
[2025-06-16T22:43:36.231Z]     164     F,
[2025-06-16T22:43:36.231Z]     165     D,
[2025-06-16T22:43:36.231Z]     166     UC,
[2025-06-16T22:43:36.231Z]     167     US,
[2025-06-16T22:43:36.231Z]     168     UI,
[2025-06-16T22:43:36.231Z]     169     UL,
[2025-06-16T22:43:36.231Z]     170     SL,
[2025-06-16T22:43:36.231Z]     171     LD,
[2025-06-16T22:43:36.231Z]     172     ULL,
[2025-06-16T22:43:36.231Z]     173     SC,
[2025-06-16T22:43:36.231Z]     174     SS,
[2025-06-16T22:43:36.231Z]     175     SI,
[2025-06-16T22:43:36.231Z]     176     SLL,
[2025-06-16T22:43:36.231Z]     177     B,
[2025-06-16T22:43:36.231Z] --> 178 ) = itkCType.initialize_c_types_once()
[2025-06-16T22:43:36.231Z]     180 # Aliases for SizeValueType, IdentifierType, OffsetType
[2025-06-16T22:43:36.231Z]     181 ST = UL
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] File /usr/local/lib/python3.10/dist-packages/itk/support/types.py:143, in itkCType.initialize_c_types_once()
[2025-06-16T22:43:36.231Z]     141 _SI: "itkCType" = itkCType("signed int", "SI", np.dtype(np.int32))
[2025-06-16T22:43:36.231Z]     142 _SLL: "itkCType" = itkCType("signed long long", "SLL", np.dtype(np.int64))
[2025-06-16T22:43:36.231Z] --> 143 _B: "itkCType" = itkCType("bool", "B", np.dtype(np.bool))
[2025-06-16T22:43:36.231Z]     144 return _F, _D, _UC, _US, _UI, _UL, _SL, _LD, _ULL, _SC, _SS, _SI, _SLL, _B
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] File /usr/local/lib/python3.10/dist-packages/numpy/__init__.py:324, in __getattr__(attr)
[2025-06-16T22:43:36.231Z]     319     warnings.warn(
[2025-06-16T22:43:36.231Z]     320         f"In the future `np.{attr}` will be defined as the "
[2025-06-16T22:43:36.231Z]     321         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
[2025-06-16T22:43:36.231Z]     323 if attr in __former_attrs__:
[2025-06-16T22:43:36.231Z] --> 324     raise AttributeError(__former_attrs__[attr])
[2025-06-16T22:43:36.231Z]     326 if attr == 'testing':
[2025-06-16T22:43:36.231Z]     327     import numpy.testing as testing
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] AttributeError: module 'numpy' has no attribute 'bool'.
[2025-06-16T22:43:36.231Z] `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
[2025-06-16T22:43:36.231Z] The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
[2025-06-16T22:43:36.231Z]     https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] 
[2025-06-16T22:43:36.231Z] real	1m2.905s
[2025-06-16T22:43:36.231Z] user	0m39.893s
[2025-06-16T22:43:36.231Z] sys	0m6.458s
[2025-06-16T22:43:36.231Z] Check failed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions