MIC-DKFZ / nnDetection

nnDetection is a self-configuring framework for 3D (volumetric) medical object detection which can be applied to new data sets without manual intervention. It includes guides for 12 data sets that were used to develop and evaluate the performance of the proposed method.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Error about numpy and nevergrad version?

camtrik opened this issue · comments

❓ Question

When running nndet_prep, got error about numpy has no attribute 'int' in nevergrad==0.4.2
How to fix it?

2024-01-22 03:05:20.885 | INFO     | nndet.planning.architecture.boxes.c002:_plan_anchors:258 - Filtered 5 boxes, 116 boxes remaining for anchor planning.
Traceback (most recent call last):
  File "/home/zhang-h/anaconda3/envs/nndetection/bin/nndet_prep", line 33, in <module>
    sys.exit(load_entry_point('nndet', 'console_scripts', 'nndet_prep')())
  File "/home/zhang-h/pytest/classic_models/nnDetection/nndet/utils/check.py", line 62, in wrapper
    return func(*args, **kwargs)
  File "/home/zhang-h/pytest/classic_models/nnDetection/scripts/preprocess.py", line 406, in main
    run(OmegaConf.to_container(cfg, resolve=True),
  File "/home/zhang-h/pytest/classic_models/nnDetection/scripts/preprocess.py", line 335, in run
    run_planning_and_process(
  File "/home/zhang-h/pytest/classic_models/nnDetection/scripts/preprocess.py", line 162, in run_planning_and_process
    plan_identifiers = planner.plan_experiment(
  File "/home/zhang-h/pytest/classic_models/nnDetection/nndet/planning/experiment/v001.py", line 43, in plan_experiment
    plan_3d = self.plan_base_stage(
  File "/home/zhang-h/pytest/classic_models/nnDetection/nndet/planning/experiment/base.py", line 234, in plan_base_stage
    architecture_plan = architecture_planner.plan(
  File "/home/zhang-h/pytest/classic_models/nnDetection/nndet/planning/architecture/boxes/c002.py", line 127, in plan
    res = super().plan(
  File "/home/zhang-h/pytest/classic_models/nnDetection/nndet/planning/architecture/boxes/base.py", line 352, in plan
    anchors = self._plan_anchors(
  File "/home/zhang-h/pytest/classic_models/nnDetection/nndet/planning/architecture/boxes/c002.py", line 270, in _plan_anchors
    params = self.find_anchors(boxes_torch, strides.astype(np.int32), anchor_generator)
  File "/home/zhang-h/pytest/classic_models/nnDetection/nndet/planning/architecture/boxes/base.py", line 445, in find_anchors
    import nevergrad as ng
  File "/home/zhang-h/anaconda3/envs/nndetection/lib/python3.9/site-packages/nevergrad/__init__.py", line 7, in <module>
    from .parametrization import parameter as p
  File "/home/zhang-h/anaconda3/envs/nndetection/lib/python3.9/site-packages/nevergrad/parametrization/__init__.py", line 9, in <module>
    from . import parameter as parameter
  File "/home/zhang-h/anaconda3/envs/nndetection/lib/python3.9/site-packages/nevergrad/parametrization/parameter.py", line 14, in <module>
    from .data import Array as Array
  File "/home/zhang-h/anaconda3/envs/nndetection/lib/python3.9/site-packages/nevergrad/parametrization/data.py", line 16, in <module>
    BoundValue = tp.Optional[tp.Union[float, int, np.int, np.float, np.ndarray]]
  File "/home/zhang-h/anaconda3/envs/nndetection/lib/python3.9/site-packages/numpy/__init__.py", line 324, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

I tried to downgrade numpy to 1.19.5, but also seems to have dependency issues.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
contourpy 1.2.0 requires numpy<2.0,>=1.20, but you have numpy 1.19.5 which is incompatible.
matplotlib 3.8.2 requires numpy<2,>=1.21, but you have numpy 1.19.5 which is incompatible.
nibabel 5.2.0 requires numpy>=1.20, but you have numpy 1.19.5 which is incompatible.
pandas 2.1.4 requires numpy<2,>=1.22.4; python_version < "3.11", but you have numpy 1.19.5 which is incompatible.
scikit-image 0.22.0 requires numpy>=1.22, but you have numpy 1.19.5 which is incompatible.
scipy 1.11.4 requires numpy<1.28.0,>=1.21.6, but you have numpy 1.19.5 which is incompatible.
seaborn 0.13.1 requires numpy!=1.24.0,>=1.20, but you have numpy 1.19.5 which is incompatible.

Seems solved by remove version request in requirements.txt and reinstall nndet ... not sure though.

Should be fixed with #182

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.