Could not find requested nnunet trainer nnUNetTrainerUMambaBot in nnunetv2.training.nnUNetTrainer
Closed this issue · 12 comments
Hi! I'm using a conda environment(which is called Mamba3) to run a Mamba-based models, but when I'm running the models, the error hints that the nnunetv2 package is used from the another environment called a3py38.
I've already installed the nnunetv2 package in my Mamba3 environment, why will it use the package in the another environment?
The error information is attached below.
(Mamba3) lyh@hlzhan-M12SWA-TF:~/models/U-Mamba$ nnUNetv2_train DATASET_ID 2d all -tr nnUNetTrainerUMambaBot
############################
INFO: You are using the old nnU-Net default plans. We have updated our recommendations. Please consider using those instead! Read more here: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md
############################
Traceback (most recent call last):
File "/home/lyh/.local/bin/nnUNetv2_train", line 8, in
sys.exit(run_training_entry())
File "/home/lyh/.conda/envs/a3py38/lib/python3.10/site-packages/nnunetv2/run/run_training.py", line 286, in run_training_entry
run_training(args.dataset_name_or_id, args.configuration, args.fold, args.tr, args.p, args.pretrained_weights,
File "/home/lyh/.conda/envs/a3py38/lib/python3.10/site-packages/nnunetv2/run/run_training.py", line 196, in run_training
nnunet_trainer = get_trainer_from_args(dataset_name_or_id, configuration, fold, trainer_class_name,
File "/home/lyh/.conda/envs/a3py38/lib/python3.10/site-packages/nnunetv2/run/run_training.py", line 43, in get_trainer_from_args
raise RuntimeError(f'Could not find requested nnunet trainer {trainer_name} in '
RuntimeError: Could not find requested nnunet trainer nnUNetTrainerUMambaBot in nnunetv2.training.nnUNetTrainer (/home/lyh/.conda/envs/a3py38/lib/python3.10/site-packages/nnunetv2/training/nnUNetTrainer). If it is located somewhere else, please move it there.
Also, I couldn't use a nnunetv2 folder under my project to directly use the customized networks in it. Instead, I'm editing the folders in the environment to solve these problems, which is not elegant.
Also, when I use pip show nnunetv2 below, it is shown that I've successfully installed nnunetv2 under the path of my project.
(Mamba3) lyh@hlzhan-M12SWA-TF:~/models/U-Mamba/umamba$ pip show nnunetv2
Name: nnunetv2
Version: 2.1.1
Summary: nnU-Net. Framework for out-of-the box biomedical image segmentation.
Home-page: https://github.com/MIC-DKFZ/nnUNet
Author: Helmholtz Imaging Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center
Author-email: f.isensee@dkfz-heidelberg.de
License: Apache License Version 2.0, January 2004
Location: /home/lyh/.conda/envs/Mamba3/lib/python3.10/site-packages
Requires: acvl-utils, batchgenerators, dicom2nifti, dynamic-network-architectures, graphviz, imagecodecs, matplotlib, medpy, monai, nibabel, numpy, opencv-python, pandas, requests, scikit-image, scikit-learn, scipy, seaborn, SimpleITK, tifffile, torch, tqdm, yacs
Required-by:
安装用的是U-Mamba仓库的nnunet吗?应该是不会用出现这段信息的:“INFO: You are using the old nnU-Net default plans. We have updated our recommendations. Please consider using those instead! Read more here: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md”
Also, I couldn't use a nnunetv2 folder under my project to directly use the customized networks in it. Instead, I'm editing the folders in the environment to solve these problems, which is not elegant.
如果是用的U-Mamba仓库的安装的,conda环境应该能识别到你要的trainer比如nnUNetTrainerUMambaBot
Have you tried adding the folder to the environment variable PYTHONPATH?
Also, I couldn't use a nnunetv2 folder under my project to directly use the customized networks in it. Instead, I'm editing the folders in the environment to solve these problems, which is not elegant.
如果是用的U-Mamba仓库的安装的,conda环境应该能识别到你要的trainer比如nnUNetTrainerUMambaBot
@gaojh135 感谢!我查了一遍好像我确实没有按照环境里umamba/setup.py
里的装,我直接pip install nnunetv2
导致planner里的json file的部分api还不一样,这几天自己手动魔改了一下api,我重新再配一个环境试试。
Have you tried adding the folder to the environment variable PYTHONPATH?
Yes, I've tried to change the PYTHONPATH env variable. However, the other packages are not laid down under the directory so there might be errors that other packages could not be detected.
My error comes from I directly used pip install nnunetv2
instead of pip install -e .
安装用的是U-Mamba仓库的nnunet吗?应该是不会用出现这段信息的:“INFO: You are using the old nnU-Net default plans. We have updated our recommendations. Please consider using those instead! Read more here: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md”
这个我说错了,也是会的,除非用它新的预处理命令nnUNetv2_plan_and_preprocess -d DATASET -pl nnUNetPlannerResEnc(M/L/XL)
https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md#point_right-we-recommend-nnu-net-resenc-l-as-the-new-default-nnu-net-configuration-point_left
安装用的是U-Mamba仓库的nnunet吗?应该是不会用出现这段信息的:“INFO: You are using the old nnU-Net default plans. We have updated our recommendations. Please consider using those instead! Read more here: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md”
这个我说错了,也是会的,除非用它新的预处理命令nnUNetv2_plan_and_preprocess -d DATASET -pl nnUNetPlannerResEnc(M/L/XL) https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md#point_right-we-recommend-nnu-net-resenc-l-as-the-new-default-nnu-net-configuration-point_left
算了,我放弃了,我不知道为什么在 /home/lyh/.local/bin/nnUNetv2_train.py
文件夹下(每个人可能不同)他第一行注释就指定了nnunetv2指定的环境,我这里每次都要改,另外UMamba的环境变量设置得也有问题,也得自己改。。。现在这玩意还算勉强能跑,我把Mamba3虚拟环境下的文件夹添加到项目里面就行了。
安装用的是U-Mamba仓库的nnunet吗?应该是不会用出现这段信息的:“INFO: You are using the old nnU-Net default plans. We have updated our recommendations. Please consider using those instead! Read more here: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md”
这个我说错了,也是会的,除非用它新的预处理命令nnUNetv2_plan_and_preprocess -d DATASET -pl nnUNetPlannerResEnc(M/L/XL) https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md#point_right-we-recommend-nnu-net-resenc-l-as-the-new-default-nnu-net-configuration-point_left
算了,我放弃了,我不知道为什么在
/home/lyh/.local/bin/nnUNetv2_train.py
文件夹下(每个人可能不同)他第一行注释就指定了nnunetv2指定的环境,我这里每次都要改,另外UMamba的环境变量设置得也有问题,也得自己改。。。现在这玩意还算勉强能跑,我把Mamba3虚拟环境下的文件夹添加到项目里面就行了。
一般是切到umamba的环境之后,他就能识别了,
https://github.com/bowang-lab/U-Mamba?tab=readme-ov-file#remarks
直接参考他这个Path settings改,base =“改成自己的路径”,环境变量应该就OK了
安装用的是U-Mamba仓库的nnunet吗?应该是不会用出现这段信息的:“INFO: You are using the old nnU-Net default plans. We have updated our recommendations. Please consider using those instead! Read more here: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md”
这个我说错了,也是会的,除非用它新的预处理命令nnUNetv2_plan_and_preprocess -d DATASET -pl nnUNetPlannerResEnc(M/L/XL) https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md#point_right-we-recommend-nnu-net-resenc-l-as-the-new-default-nnu-net-configuration-point_left
算了,我放弃了,我不知道为什么在
/home/lyh/.local/bin/nnUNetv2_train.py
文件夹下(每个人可能不同)他第一行注释就指定了nnunetv2指定的环境,我这里每次都要改,另外UMamba的环境变量设置得也有问题,也得自己改。。。现在这玩意还算勉强能跑,我把Mamba3虚拟环境下的文件夹添加到项目里面就行了。
应该是不用pip install nnunetv2的,直接把U-Mamba clone下来按他的安装教程就好了,和这边的没啥关系
确实,我每次跑不同的网络cd进去然后 pip install -e .
覆盖掉之前的nnunetv2就行了
另:老哥放不方便恰个Q?2177328784