TotalSegmentator error at first run: "Command ‘pip’, ‘install’, ‘git+https://github.com/wasserth/TotalSegmentator.git’, ‘–no-deps’]’ returned non-zero exit status"

That helped. It went one step further but then gave me this:

and this:

Processing started

Writing input file to C:/Users/starb/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-13_11+27+45.797/total-segmentator-input.nii

Creating segmentations with TotalSegmentator AI...

Total Segmentator arguments: ['-i', 'C:/Users/starb/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-13_11+27+45.797/total-segmentator-input.nii', '-o', 'C:/Users/starb/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-13_11+27+45.797/segmentation', '--ml', '--task', 'total', '--fast']

File "C:\Users\starb\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator", line 10, in <module>

ModuleNotFoundError: No module named 'nibabel'

It works for me. I installed GIT and now it works perfectly.
Thank you very much for your help.

This looks great, the main problem was solved. You now need to install the extension properly. If “Upgrade” in Advanced section does not work then probably the simplest is to reinstall Slicer and TotalSegmentator.

I’ll see if I can avoid the git installation to make the installation simpler.

1 Like

It’s working now. Thank you!

Thanks for the feedbacks. I’ve added automatic detection of git and now a more meaningful message is displayed if it is not found. I’ve also implemented automatic installation of git on Windows to make the setup a bit easier.

2 Likes

3 posts were split to a new topic: TotalSegmentator error at first run: Command …Python\Scripts\TotalSegmentator… returned non-zero exit status 120

Hi Lassoan,

can you please help me, already installed the extention for the TotalSegementator, but now the slicer is not responding now, try to restart the program, and always not responding.

using the GPU 3070. there no error message, since its says successfully installed the extention, installed the git, etc.

thank you.

Could you describe in more detail what happens exactly?

Please use the CTChest demo data for a test.

image

Select the TotalSegmentator extension and press “Apply”.
Do you see any progress messages in the textbox?

1 Like

Hi Rudolf,

thank you for the reply, i just come from my holiday so just open the forum.

yes, i do have press the apply, and nothing happen until the error message :slight_smile:

Traceback (most recent call last):
File “C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 258, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 715, in process
self.logProcessOutput(proc)
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 624, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_09+44+38.651/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_09+44+38.651/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 120.

any suggestion regarding this?

Does clicking on “Upgrade” button in Advanced section and restarting Slicer fixes the issue?

Do you have a GPU? How much GPU RAM does it have?

ITry to un-install the pytorch and reinstall, restarts the slicer, and now is working, but only the “fast” mode. for the non fast mode, its still got the same error.

Yes, I am Using Acer Predator with GPU RTX 3070 with 8GB RAM.

Do you use CPU or GPU pytorch?

Does your computer have multiple graphics card (e.g., Intel integrated graphics + NVIDIA discrete GPU)? Have you configured your NVIDIA settings to make Slicer use the GPU?

Do you have problems with any of the Slicer sample data sets?

Could you copy here the output in the textbox below the Apply button when you run with “Fast” checkbox disabled?

i dont have the option for the GPU, where can I install this? the option is only CPU, Automatic, and Cu80 until Cu112

this is the error message for the Fast Disabled using the sample data set CTChest:

Traceback (most recent call last):
File “C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 258, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 715, in process
self.logProcessOutput(proc)
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 624, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_11+15+30.020/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_11+15+30.020/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 120.

this is my Pytorch status

It seems that you have an old driver and CUDA version installed, which may cause incompatibility issues.

Please install the latest CUDA version that pytorch supports - currently CUDA 11.6 or 11.7 - and then uninstall and install pytorch.

Already update the drivers, but still got the error message:

image

the message:

Traceback (most recent call last):
File “C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 258, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 715, in process
self.logProcessOutput(proc)
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 624, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_14+12+33.314/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_14+12+33.314/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 120.

How much memory your GPU has? Do you have issues with all data sets or just some of them?

Probably the best is if you remove Slicer and reinstall it. All the experimentation with installing various pytorch versions may have messed things up.

1 Like

On my borderline laptop, I get a “less than 7 GB” warning for a “total” TotalSegmentator run with the CTChest sample dataset.

If I select “No” (no FAST mode) →

Processing completed in 226.51 seconds

System Settings:

NVIDIA System Information report created on: 01/03/2023 09:17:56
System name: LAPTOP-xxxxxxxxxx

[Display]
Operating System: Windows 10 Home, 64-bit
DirectX version: 12.0
GPU processor: NVIDIA GeForce GTX 1060
Driver version: 526.98
Driver Type: DCH
Direct3D feature level: 12_1
CUDA Cores: 1280
Core clock: 1404 MHz
Memory data rate: 8.01 Gbps
Memory interface: 192-bit
Memory bandwidth: 192.19 GB/s
Total available graphics memory: 14278 MB
Dedicated video memory: 6144 MB GDDR5
System video memory: 0 MB
Shared system memory: 8134 MB
Video BIOS version: 86.06.3A.00.0F
IRQ: Not used
Bus: PCI Express x16 Gen3
Device Id: 10DE 1C20 114E1025
Part Number: 2914 0030

Could you post your system information? See NVIDIA Control Panel → System Information

I am having the same issue with “returned non-zero exit status 120”

I have a clean install of Slicer 5.2.1. Am running with 128Gigs RAM and a 3090Ti with 24Gigs.
PyTorch is 1.13.1+cu117

I have noticed that the file that is saved in the …/fold_0 folder during processing is only called model_final_checkpoint.model - it does not have the .pkl extension as well - not sure if that is the issue?

TotalSegmentator window:
Processing started
Writing input file to C:/Users/282745H/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_17+18+42.605/total-segmentator-input.nii
Creating segmentations with TotalSegmentator AI…
Total Segmentator arguments: [‘-i’, ‘C:/Users/282745H/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_17+18+42.605/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/282745H/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_17+18+42.605/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]
Traceback (most recent call last):
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator”, line 201, in
main()
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator”, line 179, in main
seg = nnUNet_predict_image(args.input, args.output, task_id, model=model, folds=folds,
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\site-packages\totalsegmentator\nnunet.py”, line 232, in nnUNet_predict_image
nnUNet_predict(tmp_dir, tmp_dir, task_id, model, folds, trainer, tta)
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\site-packages\totalsegmentator\nnunet.py”, line 106, in nnUNet_predict
predict_from_folder(model_folder_name, dir_in, dir_out, folds, save_npz, num_threads_preprocessing,
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\site-packages\nnunet\inference\predict.py”, line 668, in predict_from_folder
return predict_cases_fastest(model, list_of_lists[part_id::num_parts], output_files[part_id::num_parts], folds,
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\site-packages\nnunet\inference\predict.py”, line 468, in predict_cases_fastest
trainer, params = load_model_and_checkpoint_files(model, folds, mixed_precision=mixed_precision, checkpoint_name=checkpoint_name)
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\site-packages\nnunet\training\model_restore.py”, line 140, in load_model_and_checkpoint_files
trainer = restore_model(join(folds[0], “%s.model.pkl” % checkpoint_name), fp16=mixed_precision)
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\site-packages\nnunet\training\model_restore.py”, line 56, in restore_model
info = load_pickle(pkl_file)
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\site-packages\batchgenerators\utilities\file_and_folder_operations.py”, line 49, in load_pickle
with open(file, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Users\282745H\.totalsegmentator\nnunet\results\nnUNet\3d_fullres\Task256_TotalSegmentator_3mm_1139subj\nnUNetTrainerV2_ep8000_nomirror__nnUNetPlansv2.1\fold_0\model_final_checkpoint.model.pkl’
Exception ignored in: <totalsegmentator.libs.DummyFile object at 0x000002BC5A99A730>
AttributeError: ‘DummyFile’ object has no attribute ‘flush’
Using ‘fast’ option: resampling to lower resolution (3mm)
Resampling…
Resampled in 0.88s
Predicting…

Small popup error window:
Traceback (most recent call last):
File “C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:/Users/282745H/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 258, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/Users/282745H/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 715, in process
self.logProcessOutput(proc)
File “C:/Users/282745H/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 624, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/282745H/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\282745H\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/282745H/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_17+18+42.605/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/282745H/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_17+18+42.605/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 120.

Already re-install my slicer, instal totalsegmentator and the pytorch again, but the same result

This is my system information:

NVIDIA System Information report created on: 01/03/2023 16:36:34
System name: PREDATOR

[Display]
Operating System: Windows 10 Home Single Language, 64-bit
DirectX version: 12.0
GPU processor: NVIDIA GeForce RTX 3070 Laptop GPU
Driver version: 527.56
Driver Type: DCH
Direct3D feature level: 12_1
CUDA Cores: 5120
Resizable BAR Yes
Max-Q Technologies 3rd Gen
Dynamic Boost 2.0 Yes
WhisperMode 2.0 Yes
Advanced Optimus No
Maximum Graphics Power 100 W
Core clock: 1290 MHz
Memory data rate: 12.00 Gbps
Memory interface: 256-bit
Memory bandwidth: 384.06 GB/s
Total available graphics memory: 16299 MB
Dedicated video memory: 8192 MB GDDR6
System video memory: 0 MB
Shared system memory: 8107 MB
Video BIOS version: 94.04.2B.40.2B
IRQ: Not used
Bus: PCI Express x16 Gen3
Device Id: 10DE 249D 14421025
Part Number: 4735 0010