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

ImportError #137

Open
tmfoley24 opened this issue Dec 9, 2024 · 1 comment
Open

ImportError #137

tmfoley24 opened this issue Dec 9, 2024 · 1 comment

Comments

@tmfoley24
Copy link

I recently had to uninstall then reinstall Ubuntu and Comp2Comp. After reinstalling I received the error below using the spine and liver_spleen_pancreas pipelines. Does anyone know how I might be able to fix this error?

Traceback (most recent call last):
File "/root/Comp2Comp/comp2comp/utils/process.py", line 131, in process_3d
pipeline(output_dir=output_dir, model_dir=model_dir)
File "/root/Comp2Comp/comp2comp/inference_pipeline.py", line 73, in call
output = inference_class(inference_pipeline=self, **output)
File "/root/Comp2Comp/comp2comp/liver_spleen_pancreas/liver_spleen_pancreas.py", line 27, in call
seg = self.organ_seg(
File "/root/Comp2Comp/comp2comp/liver_spleen_pancreas/liver_spleen_pancreas.py", line 51, in organ_seg
seg = totalsegmentator(
File "/root/miniconda3/envs/c2c_env/lib/python3.9/site-packages/totalsegmentatorv2/python_api.py", line 77, in totalsegmentator
from totalsegmentatorv2.nnunet import nnUNet_predict_image # this has to be after setting new env vars
File "/root/miniconda3/envs/c2c_env/lib/python3.9/site-packages/totalsegmentatorv2/nnunet.py", line 24, in
from nnunetv2.inference.predict_from_raw_data import nnUNetPredictor
File "/root/miniconda3/envs/c2c_env/lib/python3.9/site-packages/nnunetv2/inference/predict_from_raw_data.py", line 22, in
from nnunetv2.inference.data_iterators import PreprocessAdapterFromNpy, preprocessing_iterator_fromfiles,
File "/root/miniconda3/envs/c2c_env/lib/python3.9/site-packages/nnunetv2/inference/data_iterators.py", line 12, in
from nnunetv2.preprocessing.preprocessors.default_preprocessor import DefaultPreprocessor
File "/root/miniconda3/envs/c2c_env/lib/python3.9/site-packages/nnunetv2/preprocessing/preprocessors/default_preprocessor.py", line 23, in
from nnunetv2.preprocessing.cropping.cropping import crop_to_nonzero
File "/root/miniconda3/envs/c2c_env/lib/python3.9/site-packages/nnunetv2/preprocessing/cropping/cropping.py", line 5, in
from acvl_utils.cropping_and_padding.bounding_boxes import get_bbox_from_mask, crop_to_bbox, bounding_box_to_slice
ImportError: cannot import name 'crop_to_bbox' from 'acvl_utils.cropping_and_padding.bounding_boxes' (/root/miniconda3/envs/c2c_env/lib/python3.9/site-packages/acvl_utils/cropping_and_padding/bounding_boxes.py)

@giemmecci
Copy link

giemmecci commented Dec 9, 2024

I've had a similar issue two days ago, and my conclusion was that it probably has to do with recent changes introduced in the bounding_boxes.py file here:

https://github.com/MIC-DKFZ/acvl_utils/tree/master/acvl_utils/cropping_and_padding

And I think this discussion is related:

https://github.com/MIC-DKFZ/acvl_utils/issues/4

I put a temporary fix to it by replacing the whole acvl_utils folder at the location below from a previous installation of comp2comp:

/anaconda3/envs/c2c_env/lib/python3.9/site-packages/acvl_utils

Further discussion also here (it has the same error message I was getting):

https://github.com/MIC-DKFZ/nnUNet/issues/2589#issuecomment-2464528411

And this seems to be the solution that worked for most:

https://github.com/MIC-DKFZ/nnUNet/issues/2589#issuecomment-2464528411

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

2 participants