Skip to content
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

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

Open
yarinbar opened this issue Jun 20, 2024 · 2 comments
Open

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

yarinbar opened this issue Jun 20, 2024 · 2 comments

Comments

@yarinbar
Copy link

yarinbar commented Jun 20, 2024

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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants