MIC-DKFZ / MedNeXt

[MICCAI 2023] MedNeXt is a fully ConvNeXt architecture for 3D medical image segmentation.
https://arxiv.org/pdf/2303.09975
Apache License 2.0
348 stars 26 forks source link

Import of nnunet (v1) fails when running pre-processing #23

Open yarinbar opened 5 months ago

yarinbar commented 5 months ago

I followed the instructions in https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/installation_instructions.md and cloned the repo locally and used pip install -e . but it only installs the v2 so in the prepocessing i get an error:

Traceback (most recent call last):
  File "C:\Users\asiel\cathAlert\experimental\MedNeXt\nnunet_mednext\experiment_planning\nnUNet_plan_and_preprocess.py", line 170, in <module>
    main()
  File "C:\Users\asiel\cathAlert\experimental\MedNeXt\nnunet_mednext\experiment_planning\nnUNet_plan_and_preprocess.py", line 166, in main
    exp_planner.run_preprocessing(threads)
  File "C:\Users\asiel\cathAlert\experimental\MedNeXt\nnunet_mednext\experiment_planning\experiment_planner_baseline_3DUNet.py", line 434, in run_preprocessing
    preprocessor_class = recursive_find_python_class([join(nnunet_mednext.__path__[0], "preprocessing")],
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\asiel\cathAlert\experimental\MedNeXt\nnunet_mednext\training\model_restore.py", line 38, in recursive_find_python_class
    m = importlib.import_module(current_module + "." + modname)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\asiel\anaconda3\envs\mednext\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'nnunet'

I would appreciate any help :)

KanielDatz commented 5 months ago

same here, appreciate your help and effort


run_preprocessing
    preprocessor_class = recursive_find_python_class([join(nnunet_mednext.__path__[0], "preprocessing")],
  File "/home/cathalert/mednext/nnunet_mednext/training/model_restore.py", line 28, in recursive_find_python_class
    m = importlib.import_module(current_module + "." + modname)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'nnunet'
dani-capellan commented 5 months ago

Yes, I had the same issue, you need to install nnUNet-v1, instructions here: https://github.com/MIC-DKFZ/nnUNet/tree/nnunetv1?tab=readme-ov-file#installation. This implementation of MedNeXt is based on nnUNet-v1, that is why you need some packages and functions from nnUNet-v1's implementation.