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

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

Sorry for the errors, hope we can fix them. The two systems indicated above should definitely be capable of doing complete TotalSegmentator GPU runs.

Please understand that the 3D Slicer extension is a wrapper of the TotalSegmentator AI tool.
Have you tried something simple as running Slicer in Admin mode?

You could also install TotalSegmentator in a local Python installation and run it from the command line, which is what we did before implementing the tool wrapper in 3D Slicer.

Could you uninstall PyTorch completely with the PyTorch extension.
Use the restart option and repeat until you get a uninstall success message.
Then paste

slicer.util.pip_install("torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117")

it into the Python Interactor and press return and wait until it is installed.

This looks like a real error. Maybe the model download have been interrupted. Please remove the entire .totalsegmentator folder and retry.

Laptop with Optimus technology (switchable integrated graphics/discrete GPU) are always problematic. As a quick test, disable Optimus (choose to always use the GPU for all software) and see if it fixes the issue. If you still get some error then you can contact me in a private message to set up a call with screen sharing so that I can have a closer look.

1 Like

Thank you so much for the response @lassoan! Deleting the .totalsegmentator folder is the only thing I hadn’t thought of, all is now working perfectly. You are an absolute legend!

1 Like

Experienced the same “status 120” error on a fresh AWS EC2 instance today after installation of PyTorch via the extension and running TotalSegmentator.

It happened upon the first run.
Restarted Slicer and “Upgraded” once which resolved the error.

image

Is your problem solved by now?

@rbumm This is very useful information. I’ve updated TotalSegmentator extension following fixes in the Python package. We don’t need the SimpleITK installation hack and git installation anymore. Could you try if Slicer-5.2.1 installation with latest TotalSegmentator still runs into status 120 on a fresh EC2 instance?

1 Like

@lassoan Sure. Would I need to fork the extension or just install it from the extension manager?

Just install Slicer-5.2.1 from scratch and install TotalSegmentator extension from the Extensions Manager.

1 Like

@lassoan Now it works. On the fresh EC2 instance (g5.xlarge), PyTorch installs completely from the extension and recognizes the new NVIDIA A10G drivers.

TotalSegmentator installs upon the first run, but takes a while to complete:
Processing completed in 558.95 seconds

The second run:
Processing completed in 110.23 seconds

Awesome! Thanks for testing.

First run takes long time because the model weight files (about 1.6GB) have to be downloaded. If this delay causes a problem (slow, unreliable, etc) then we found have a look at where the files are hosted and if adding mirrors would make sense.

2 Likes

Hi I am having a similar problem. I have m2 MacBook. I have tried all the above including updating PyTorch/total seg as well as downloading git. I have also changed from GPU to CPU in edit-application setting–> volume rendering–>VTK CPU (from GPU). I am using sample data. It works for the MRI head. but when I use on CTAP or CT liver or even my own DICOM CT Chest it brings up error messages.

This is my error message
Traceback (most recent call last):
File “/Applications/Slicer.app/Contents/bin/Python/slicer/util.py”, line 2973, in tryWithErrorDisplay
yield
File “/Applications/Slicer.app/Contents/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 264, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “/Applications/Slicer.app/Contents/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 799, in process
self.logProcessOutput(proc)
File “/Applications/Slicer.app/Contents/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 692, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[’/Applications/Slicer.app/Contents/bin/…/bin/PythonSlicer’, ‘/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator’, ‘-i’, ‘/private/var/folders/9l/6p4fv9qs1gb_22w9xm8_fm2r0000gn/T/Slicer-omarel-taji/__SlicerTemp__2023-04-30_02+17+21.212/total-segmentator-input.nii’, ‘-o’, ‘/private/var/folders/9l/6p4fv9qs1gb_22w9xm8_fm2r0000gn/T/Slicer-omarel-taji/__SlicerTemp__2023-04-30_02+17+21.212/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 120.

Thanks

Please start all over again.

It would be great if you could read the troubleshooting section of the TotalSegmentator extension in the beginning.

  • Uninstall 3D Slicer and delete the installation directory.
  • Install 3D Slicer stable in a new directory.
  • Install the Pytorch extension.
  • In the Pytorch extension, select CPU support just for a test.

image

  • Install Pytorch.
  • Restart 3D Slicer.
  • Install the Totalsegmentator extension.
  • Load the CT Chest dataset
  • Run TotalSegmentator (will take longer because of using CPU).

If not working, please post the results of the log and/or complete content of progress window here.
We will handle GPU support later, probably by someone who has an M2 Macbook at hand. Not sure GPU support works in this case.

I am having a similar problem too.

I installed pytorch module and totalsegmentator in extensions manager,and installed NVIDIA CUDA11.8 and GIT.
But there was still some errors when running the program.Need help to solve this,thx!

Here are the error infos。

first try:
Traceback (most recent call last):
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 2967, in tryWithErrorDisplay
yield
File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 255, in onApplyButton
self.logic.setupPythonRequirements()
File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 660, in setupPythonRequirements
slicer.util.pip_install(self.totalSegmentatorPythonPackageDownloadUrl)
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 3578, in pip_install
_executePythonModule(‘pip’, args)
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 3540, in _executePythonModule
logProcessOutput(proc)
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 3509, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command '‘C:/Users/sain/Desktop/3DSilcer/Slicer 5.2.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, '[https://github.com/wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip’]’ returned non-zero exit status 1.

second try:
Traceback (most recent call last):
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 2967, in tryWithErrorDisplay
yield
File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 255, in onApplyButton
self.logic.setupPythonRequirements()
File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 660, in setupPythonRequirements
slicer.util.pip_install(self.totalSegmentatorPythonPackageDownloadUrl)
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 3578, in pip_install
_executePythonModule(‘pip’, args)
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 3540, in _executePythonModule
logProcessOutput(proc)
File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.2.2\bin\Python\slicer\util.py”, line 3509, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command '‘C:/Users/sain/Desktop/3DSilcer/Slicer 5.2.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, '[https://github.com/wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip’]’ returned non-zero exit status 2.

Could you try with the latest Slicer Preview Release?

1 Like

Thank you for your reply!
When i try with Slicer 5.3.0,there is new error.How can I solve this problem?thx!
Here are the error infos。

Traceback (most recent call last):

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\bin\Python\slicer\util.py”, line 2973, in tryWithErrorDisplay

yield

File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/slicer.org/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 264, in onApplyButton

self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),

File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/slicer.org/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 799, in process

self.logProcessOutput(proc)

File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/slicer.org/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 692, in logProcessOutput

raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)

subprocess.CalledProcessError: Command ‘[‘C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_09+14+18.597/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_09+14+18.597/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 1.

What is the pytorch and NVIDIA driver version displayed in Pytorch Utils module?

Could you try to run the segmentation again and copy here all the output that you can find the the application log (menu: Help / Report a bug)?

PyTorch:installed version 2.0.1+cu118
NVIDIA driver:installed version 531.14

I try to run the segmentation again and here are all the output。

Processing started

Writing input file to C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_10+01+57.716/total-segmentator-input.nii

Creating segmentations with TotalSegmentator AI…

Total Segmentator arguments: [‘-i’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_10+01+57.716/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_10+01+57.716/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]

If you use this tool please cite: [2208.05868] TotalSegmentator: robust segmentation of 104 anatomical structures in CT images

Using ‘fast’ option: resampling to lower resolution (3mm)

Downloading pretrained weights for Task 256 (~230MB) …

Traceback (most recent call last):

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\connection.py”, line 174, in _new_conn

conn = connection.create_connection(

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\util\connection.py”, line 72, in create_connection

for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\socket.py”, line 954, in getaddrinfo

for res in _socket.getaddrinfo(host, port, family, type, proto, flags):

socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\connectionpool.py”, line 703, in urlopen

httplib_response = self._make_request(

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\connectionpool.py”, line 386, in _make_request

self._validate_conn(conn)

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\connectionpool.py”, line 1042, in _validate_conn

conn.connect()

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\connection.py”, line 358, in connect

self.sock = conn = self._new_conn()

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\connection.py”, line 186, in _new_conn

raise NewConnectionError(

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000002D3ADC85D90>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\requests\adapters.py”, line 489, in send

resp = conn.urlopen(

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\connectionpool.py”, line 787, in urlopen

retries = retries.increment(

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\urllib3\util\retry.py”, line 592, in increment

raise MaxRetryError(_pool, url, error or ResponseError(cause))

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘zenodo.org’, port=443): Max retries exceeded with url: /record/6802052/files/Task256_TotalSegmentator_3mm_1139subj.zip?download=1 (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x000002D3ADC85D90>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Scripts\TotalSegmentator”, line 93, in

main()

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Scripts\TotalSegmentator”, line 86, in main

totalsegmentator(args.input, args.output, args.ml, args.nr_thr_resamp, args.nr_thr_saving,

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\totalsegmentator\python_api.py”, line 157, in totalsegmentator

download_pretrained_weights(task_id)

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\totalsegmentator\libs.py”, line 183, in download_pretrained_weights

download_url_and_unpack(WEIGHTS_URL, config_dir)

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\totalsegmentator\libs.py”, line 69, in download_url_and_unpack

raise e

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\totalsegmentator\libs.py”, line 55, in download_url_and_unpack

with requests.get(url, stream=True) as r:

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\requests\api.py”, line 73, in get

return request(“get”, url, params=params, **kwargs)

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\requests\api.py”, line 59, in request

return session.request(method=method, url=url, **kwargs)

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\requests\sessions.py”, line 587, in request

resp = self.send(prep, **send_kwargs)

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\requests\sessions.py”, line 701, in send

r = adapter.send(request, **kwargs)

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Lib\site-packages\requests\adapters.py”, line 565, in send

raise ConnectionError(e, request=request)

requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘zenodo.org’, port=443): Max retries exceeded with url: /record/6802052/files/Task256_TotalSegmentator_3mm_1139subj.zip?download=1 (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x000002D3ADC85D90>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed’))

Failed to compute results.

Command ‘[‘C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_10+01+57.716/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_10+01+57.716/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 1.

Traceback (most recent call last):

File “C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\bin\Python\slicer\util.py”, line 2973, in tryWithErrorDisplay

yield

File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/slicer.org/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 264, in onApplyButton

self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),

File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/slicer.org/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 799, in process

self.logProcessOutput(proc)

File “C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/slicer.org/Extensions-31734/TotalSegmentator/lib/Slicer-5.3/qt-scripted-modules/TotalSegmentator.py”, line 692, in logProcessOutput

raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)

subprocess.CalledProcessError: Command ‘[‘C:/Users/sain/Desktop/3DSilcer/Slicer 5.3.0/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\sain\Desktop\3DSilcer\Slicer 5.3.0\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_10+01+57.716/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/sain/AppData/Local/Temp/Slicer/__SlicerTemp__2023-05-10_10+01+57.716/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 1.

This indicates that TotalSegmentator could not download the segmentation model weights from the internet. You are either not connected to the internet or firewall/proxy server prevents you from accessing the server.

You can either fix your internet connection (you may need to use VPN if you are in China, etc.) or download the model weights manually (see for example Run TotalSegmentator error · Issue #93 · wasserth/TotalSegmentator · GitHub and Use pre-downloaded weights in containerised implementation · Issue #60 · wasserth/TotalSegmentator · GitHub).

I download the model weights and paste files to the 3d_fullres folder.
It’s working now. Thank you!

2 Likes