TotalSegmentator: Failed to install required packages

Operating system: MacOS Big Sur 11.4
Slicer version: 5.6.2
Hello,

I have installed Slicer, installed Pytorch version 2.2.2 via the Pytorch utils module, installed the 3d segmentator module, and restarted Slicer. When attempting to run segmentation on test CT Chest data, I get the following error.

Failed to install required packages.

Command ‘[’/Applications/Slicer.app/Contents/bin/…/bin/PythonSlicer’, ‘-m’, ‘pip’, ‘install’, ‘rt-utils’]’ returned non-zero exit status 1.

Here are the more detailed logs:

TotalSegmentator Python package is required. Installing it from https://github.com/wasserth/TotalSegmentator/archive/7274faac4673298d17b63a5a8335006f02e6d426.zip… (it may take several minutes)

  • Installing numpy<2…

  • Installing nibabel>=2.3.0…

  • Installing tqdm>=4.45.0…

  • Installing p-tqdm…

  • Installing xvfbwrapper…

  • Installing rt-utils…

Failed to install Python dependencies:

Command ‘[’/Applications/Slicer.app/Contents/bin/…/bin/PythonSlicer’, ‘-m’, ‘pip’, ‘install’, ‘rt-utils’]’ returned non-zero exit status 1.

I have also attempted a force reinstall Total Segmentator Python package under advanced settings and this did not work. Would appreciate your help. Thank you.

Please copy here the full application log (menu: Help / Report a bug).

Was not able to copy whole log due to character limit. Copied portions that may be relevant below:

[INFO][Stream] 15.09.2024 22:03:41 [] (unknown:0) - Successfully built TotalSegmentator

[INFO][Stream] 15.09.2024 22:03:41 [] (unknown:0) - Installing collected packages: TotalSegmentator

[INFO][Stream] 15.09.2024 22:03:41 [] (unknown:0) - WARNING: The scripts TotalSegmentator, crop_to_body, totalseg_combine_masks, totalseg_download_weights, totalseg_get_phase, totalseg_import_weights, totalseg_set_license and totalseg_setup_manually are installed in '/Applications/Slicer.app/Contents/lib/Python/bin' which is not on PATH.

[INFO][Stream] 15.09.2024 22:03:41 [] (unknown:0) - Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

[INFO][Stream] 15.09.2024 22:03:41 [] (unknown:0) - Successfully installed TotalSegmentator-2.4.0

[INFO][Python] 15.09.2024 22:03:41 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing numpy<2...

[INFO][Stream] 15.09.2024 22:03:42 [] (unknown:0) - Requirement already satisfied: numpy<2 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (1.26.1)

[INFO][Python] 15.09.2024 22:03:43 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing nibabel>=2.3.0...

[INFO][Stream] 15.09.2024 22:03:43 [] (unknown:0) - Collecting nibabel>=2.3.0

[INFO][Stream] 15.09.2024 22:03:43 [] (unknown:0) - Obtaining dependency information for nibabel>=2.3.0 from https://files.pythonhosted.org/packages/77/3f/ce43b8c2ccc4a7913a87c4d425aaf0080ea3abf947587e47dc2025981a17/nibabel-5.2.1-py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:43 [] (unknown:0) - Using cached nibabel-5.2.1-py3-none-any.whl.metadata (8.8 kB)

[INFO][Stream] 15.09.2024 22:03:43 [] (unknown:0) - Requirement already satisfied: numpy>=1.20 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from nibabel>=2.3.0) (1.26.1)

[INFO][Stream] 15.09.2024 22:03:43 [] (unknown:0) - Requirement already satisfied: packaging>=17 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from nibabel>=2.3.0) (23.2)

[INFO][Stream] 15.09.2024 22:03:43 [] (unknown:0) - Using cached nibabel-5.2.1-py3-none-any.whl (3.3 MB)

[INFO][Stream] 15.09.2024 22:03:44 [] (unknown:0) - Installing collected packages: nibabel

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - WARNING: The scripts nib-conform, nib-convert, nib-dicomfs, nib-diff, nib-ls, nib-nifti-dx, nib-roi, nib-stats, nib-tck2trk, nib-trk2tck and parrec2nii are installed in '/Applications/Slicer.app/Contents/lib/Python/bin' which is not on PATH.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - totalsegmentator 2.4.0 requires dicom2nifti, which is not installed.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - totalsegmentator 2.4.0 requires p-tqdm, which is not installed.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - totalsegmentator 2.4.0 requires pyarrow, which is not installed.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - totalsegmentator 2.4.0 requires rt-utils, which is not installed.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - totalsegmentator 2.4.0 requires tqdm>=4.45.0, which is not installed.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - totalsegmentator 2.4.0 requires xvfbwrapper, which is not installed.

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - Successfully installed nibabel-5.2.1

[INFO][Python] 15.09.2024 22:03:45 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing tqdm>=4.45.0...

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - Collecting tqdm>=4.45.0

[INFO][Stream] 15.09.2024 22:03:45 [] (unknown:0) - Obtaining dependency information for tqdm>=4.45.0 from https://files.pythonhosted.org/packages/48/5d/acf5905c36149bbaec41ccf7f2b68814647347b72075ac0b1fe3022fdc73/tqdm-4.66.5-py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - Using cached tqdm-4.66.5-py3-none-any.whl.metadata (57 kB)

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - Using cached tqdm-4.66.5-py3-none-any.whl (78 kB)

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - Installing collected packages: tqdm

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - WARNING: The script tqdm is installed in '/Applications/Slicer.app/Contents/lib/Python/bin' which is not on PATH.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - totalsegmentator 2.4.0 requires dicom2nifti, which is not installed.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - totalsegmentator 2.4.0 requires p-tqdm, which is not installed.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - totalsegmentator 2.4.0 requires pyarrow, which is not installed.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - totalsegmentator 2.4.0 requires rt-utils, which is not installed.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - totalsegmentator 2.4.0 requires xvfbwrapper, which is not installed.

[INFO][Stream] 15.09.2024 22:03:46 [] (unknown:0) - Successfully installed tqdm-4.66.5

[INFO][Python] 15.09.2024 22:03:46 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing p-tqdm...

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Collecting p-tqdm

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached p_tqdm-1.4.2-py3-none-any.whl

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Requirement already satisfied: tqdm>=4.45.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from p-tqdm) (4.66.5)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Collecting pathos>=0.2.5 (from p-tqdm)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Obtaining dependency information for pathos>=0.2.5 from https://files.pythonhosted.org/packages/f4/7f/cea34872c000d17972dad998575d14656d7c6bcf1a08a8d66d73c1ef2cca/pathos-0.3.2-py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached pathos-0.3.2-py3-none-any.whl.metadata (11 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Requirement already satisfied: six>=1.13.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from p-tqdm) (1.16.0)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Collecting ppft>=1.7.6.8 (from pathos>=0.2.5->p-tqdm)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Obtaining dependency information for ppft>=1.7.6.8 from https://files.pythonhosted.org/packages/ff/fa/5160c7d2fb1d4f2b83cba7a40f0eb4b015b78f6973b7ab6b2e73c233cfdc/ppft-1.7.6.8-py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached ppft-1.7.6.8-py3-none-any.whl.metadata (12 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Collecting dill>=0.3.8 (from pathos>=0.2.5->p-tqdm)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Obtaining dependency information for dill>=0.3.8 from https://files.pythonhosted.org/packages/c9/7a/cef76fd8438a42f96db64ddaa85280485a9c395e7df3db8158cfec1eee34/dill-0.3.8-py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached dill-0.3.8-py3-none-any.whl.metadata (10 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Collecting pox>=0.3.4 (from pathos>=0.2.5->p-tqdm)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Obtaining dependency information for pox>=0.3.4 from https://files.pythonhosted.org/packages/e1/d7/9e73c32f73da71e8224b4cb861b5db50ebdebcdff14d3e3fb47a63c578b2/pox-0.3.4-py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached pox-0.3.4-py3-none-any.whl.metadata (8.0 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Collecting multiprocess>=0.70.16 (from pathos>=0.2.5->p-tqdm)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Obtaining dependency information for multiprocess>=0.70.16 from https://files.pythonhosted.org/packages/da/d9/f7f9379981e39b8c2511c9e0326d212accacb82f12fbfdc1aa2ce2a7b2b6/multiprocess-0.70.16-py39-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached multiprocess-0.70.16-py39-none-any.whl.metadata (7.2 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached pathos-0.3.2-py3-none-any.whl (82 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached dill-0.3.8-py3-none-any.whl (116 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached multiprocess-0.70.16-py39-none-any.whl (133 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached pox-0.3.4-py3-none-any.whl (29 kB)

[INFO][Stream] 15.09.2024 22:03:47 [] (unknown:0) - Using cached ppft-1.7.6.8-py3-none-any.whl (56 kB)

[INFO][Stream] 15.09.2024 22:03:48 [] (unknown:0) - Installing collected packages: ppft, pox, dill, multiprocess, pathos, p-tqdm

[INFO][Stream] 15.09.2024 22:03:48 [] (unknown:0) - ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

[INFO][Stream] 15.09.2024 22:03:48 [] (unknown:0) - totalsegmentator 2.4.0 requires dicom2nifti, which is not installed.

[INFO][Stream] 15.09.2024 22:03:48 [] (unknown:0) - totalsegmentator 2.4.0 requires pyarrow, which is not installed.

[INFO][Stream] 15.09.2024 22:03:48 [] (unknown:0) - totalsegmentator 2.4.0 requires rt-utils, which is not installed.

[INFO][Stream] 15.09.2024 22:03:48 [] (unknown:0) - totalsegmentator 2.4.0 requires xvfbwrapper, which is not installed.

[INFO][Stream] 15.09.2024 22:03:48 [] (unknown:0) - Successfully installed dill-0.3.8 multiprocess-0.70.16 p-tqdm-1.4.2 pathos-0.3.2 pox-0.3.4 ppft-1.7.6.8

[INFO][Python] 15.09.2024 22:03:48 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing xvfbwrapper...

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - Collecting xvfbwrapper

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - Using cached xvfbwrapper-0.2.9-py3-none-any.whl

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - Installing collected packages: xvfbwrapper

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - totalsegmentator 2.4.0 requires dicom2nifti, which is not installed.

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - totalsegmentator 2.4.0 requires pyarrow, which is not installed.

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - totalsegmentator 2.4.0 requires rt-utils, which is not installed.

[INFO][Stream] 15.09.2024 22:03:49 [] (unknown:0) - Successfully installed xvfbwrapper-0.2.9

[INFO][Python] 15.09.2024 22:03:50 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing rt-utils...

[INFO][Stream] 15.09.2024 22:03:50 [] (unknown:0) - Collecting rt-utils

[INFO][Stream] 15.09.2024 22:03:50 [] (unknown:0) - Obtaining dependency information for rt-utils from https://files.pythonhosted.org/packages/84/f7/4212ac81d23733a79415dc0cc8c7d0d795ca025d5cdb34d1887a0402a6cb/rt_utils-1.2.7-py2.py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:03:50 [] (unknown:0) - Using cached rt_utils-1.2.7-py2.py3-none-any.whl.metadata (7.5 kB)

[INFO][Stream] 15.09.2024 22:03:50 [] (unknown:0) - Requirement already satisfied: pydicom in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from rt-utils) (2.4.3)

[INFO][Stream] 15.09.2024 22:03:50 [] (unknown:0) - Requirement already satisfied: numpy in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from rt-utils) (1.26.1)

[INFO][Stream] 15.09.2024 22:03:51 [] (unknown:0) - Collecting opencv-python (from rt-utils)

[INFO][Stream] 15.09.2024 22:03:51 [] (unknown:0) - Using cached opencv-python-4.10.0.84.tar.gz (95.1 MB)

[INFO][Stream] 15.09.2024 22:03:58 [] (unknown:0) - Installing build dependencies: started

[INFO][Stream] 15.09.2024 22:04:09 [] (unknown:0) - Installing build dependencies: finished with status 'done'

[INFO][Stream] 15.09.2024 22:04:09 [] (unknown:0) - Getting requirements to build wheel: started

[INFO][Stream] 15.09.2024 22:04:10 [] (unknown:0) - Getting requirements to build wheel: finished with status 'done'

[INFO][Stream] 15.09.2024 22:04:10 [] (unknown:0) - Preparing metadata (pyproject.toml): started

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Preparing metadata (pyproject.toml): finished with status 'done'

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Collecting dataclasses (from rt-utils)

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Obtaining dependency information for dataclasses from https://files.pythonhosted.org/packages/26/2f/1095cdc2868052dd1e64520f7c0d5c8c550ad297e944e641dbf1ffbb9a5d/dataclasses-0.6-py3-none-any.whl.metadata

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Using cached dataclasses-0.6-py3-none-any.whl.metadata (3.0 kB)

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Using cached rt_utils-1.2.7-py2.py3-none-any.whl (18 kB)

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Using cached dataclasses-0.6-py3-none-any.whl (14 kB)

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Building wheels for collected packages: opencv-python

[INFO][Stream] 15.09.2024 22:04:11 [] (unknown:0) - Building wheel for opencv-python (pyproject.toml): started

[INFO][Stream] 15.09.2024 22:05:12 [] (unknown:0) - Building wheel for opencv-python (pyproject.toml): still running...

...

INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       #include <Python.h>
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -                ^~~~~~~~~~
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       1 error generated.
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       make: *** [all] Error 2
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       Traceback (most recent call last):
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -         File "/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-mom19h7d/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 668, in setup
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -           cmkr.make(make_args, install_target=cmake_install_target, env=env)
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -         File "/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-mom19h7d/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 696, in make
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -           self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -         File "/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-mom19h7d/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 741, in make_impl
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -           raise SKBuildError(msg)
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       An error occurred while building with CMake.
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -         Command:
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -           /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-mom19h7d/overlay/lib/python3.9/site-packages/cmake/data/bin/cmake --build . --target install --config Release --
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -         Install target:
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -           install
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -         Source directory:
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -           /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-install-rs3opx14/opencv-python_3ac362bd7bcc47caa112dc6c55c41cf0
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -         Working directory:
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -           /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-install-rs3opx14/opencv-python_3ac362bd7bcc47caa112dc6c55c41cf0/_skbuild/macosx-11.0-x86_64-3.9/cmake-build
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       Please check the install target is valid and see CMake's output for more information.
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -       [end of output]
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -   note: This error originates from a subprocess, and is likely not a problem with pip.
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) -   ERROR: Failed building wheel for opencv-python
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) - Failed to build opencv-python
[INFO][Stream] 15.09.2024 22:35:57 [] (unknown:0) - ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 274, in onApplyButton
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -     self.logic.setupPythonRequirements()
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 788, in setupPythonRequirements
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -     skippedRequirements = self.pipInstallSelective(
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 706, in pipInstallSelective
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -     slicer.util.pip_install(requirement)
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3887, in pip_install
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -     _executePythonModule("pip", args)
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3848, in _executePythonModule
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -     logProcessOutput(proc)
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3814, in logProcessOutput
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) -     raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
[CRITICAL][Stream] 15.09.2024 22:36:00 [] (unknown:0) - subprocess.CalledProcessError: Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '-m', 'pip', 'install', 'rt-utils']' returned non-zero exit status 1.
[ERROR][Python] 15.09.2024 22:36:00 [Python] (/Applications/Slicer.app/Contents/bin/Python/slicer/util.py:3009) - Failed to install required packages.

A post was split to a new topic: Problem with AI lung segmentation in LungCTAnalyzer

Failed to build opencv-python

TotalSegmentator listed rt_utils in its dependency list, which is an unnecessary package (it is only needed for RTSTRUCT export, but Slicer can do that already) and it is a problematic package, because it depends on opencv-python, which is a complex, messy package that often fails to build.

I’ve updated TotalSegmentator extension to skip rt_utils package. If you use latest Slicer Stable Release then all you need is to update the TotalSegmentator extension tomorrow and reinstall the Python packages.

Thank you, however I followed your advice and am still coming up with a similar error. I updated the TotalSegmentator extension and selected force reinstall TotalSegmentator python package. Error log as below:

Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator', '-i', '/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/Slicer-govindmattay/__SlicerTemp__2024-09-20_09+26+03.691/total-segmentator-input.nii', '-o', '/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/Slicer-govindmattay/__SlicerTemp__2024-09-20_09+26+03.691/segmentation', '--fast']' returned non-zero exit status 1.
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 307, in onApplyButton
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -     self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 1002, in process
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -     self.processVolume(inputFile, inputVolume,
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 1042, in processVolume
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -     self.logProcessOutput(proc)
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 848, in logProcessOutput
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) -     raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
[CRITICAL][Stream] 20.09.2024 09:26:40 [] (unknown:0) - subprocess.CalledProcessError: Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator', '-i', '/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/Slicer-govindmattay/__SlicerTemp__2024-09-20_09+26+03.691/total-segmentator-input.nii', '-o', '/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/Slicer-govindmattay/__SlicerTemp__2024-09-20_09+26+03.691/segmentation', '--fast']' returned non-zero exit status 1.
[INFO][Python] 20.09.2024 09:27:34 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py:153) - Importing torch...
[INFO][Python] 20.09.2024 09:27:34 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py:190) - PyTorch 2.2.2 imported successfully
[INFO][Python] 20.09.2024 09:27:34 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py:191) - CUDA available: False
[INFO][Python] 20.09.2024 09:27:34 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - TotalSegmentator Python package is required. Installing it from https://github.com/wasserth/TotalSegmentator/archive/7274faac4673298d17b63a5a8335006f02e6d426.zip... (it may take several minutes)
[INFO][Stream] 20.09.2024 09:27:36 [] (unknown:0) - Found existing installation: TotalSegmentator 2.4.0
[INFO][Stream] 20.09.2024 09:27:36 [] (unknown:0) - Uninstalling TotalSegmentator-2.4.0:
[INFO][Stream] 20.09.2024 09:27:36 [] (unknown:0) -   Successfully uninstalled TotalSegmentator-2.4.0
[INFO][Stream] 20.09.2024 09:27:36 [] (unknown:0) - Collecting https://github.com/wasserth/TotalSegmentator/archive/7274faac4673298d17b63a5a8335006f02e6d426.zip
[INFO][Stream] 20.09.2024 09:27:37 [] (unknown:0) -   Using cached https://github.com/wasserth/TotalSegmentator/archive/7274faac4673298d17b63a5a8335006f02e6d426.zip
[INFO][Stream] 20.09.2024 09:27:37 [] (unknown:0) -   Installing build dependencies: started
[INFO][Stream] 20.09.2024 09:27:41 [] (unknown:0) -   Installing build dependencies: finished with status 'done'
[INFO][Stream] 20.09.2024 09:27:41 [] (unknown:0) -   Getting requirements to build wheel: started
[INFO][Stream] 20.09.2024 09:27:41 [] (unknown:0) -   Getting requirements to build wheel: finished with status 'done'
[INFO][Stream] 20.09.2024 09:27:41 [] (unknown:0) -   Preparing metadata (pyproject.toml): started
[INFO][Stream] 20.09.2024 09:27:41 [] (unknown:0) -   Preparing metadata (pyproject.toml): finished with status 'done'
[INFO][Stream] 20.09.2024 09:27:41 [] (unknown:0) - Building wheels for collected packages: TotalSegmentator
[INFO][Stream] 20.09.2024 09:27:41 [] (unknown:0) -   Building wheel for TotalSegmentator (pyproject.toml): started
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) -   Building wheel for TotalSegmentator (pyproject.toml): finished with status 'done'
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) -   Created wheel for TotalSegmentator: filename=TotalSegmentator-2.4.0-py3-none-any.whl size=348308 sha256=261f5e08838790ecd65fe568dff3be1b1fd1d87354b3c5231be3adfc1b40a280
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) -   Stored in directory: /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-ephem-wheel-cache-yucaapnd/wheels/d8/41/ce/20b3efb2dd6cebf94e551445b85bf8412c77d640fe7bd41cbb
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) - Successfully built TotalSegmentator
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) - Installing collected packages: TotalSegmentator
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) -   WARNING: The scripts TotalSegmentator, crop_to_body, totalseg_combine_masks, totalseg_download_weights, totalseg_get_phase, totalseg_import_weights, totalseg_set_license and totalseg_setup_manually are installed in '/Applications/Slicer.app/Contents/lib/Python/bin' which is not on PATH.
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) -   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) - Successfully installed TotalSegmentator-2.4.0
[INFO][Python] 20.09.2024 09:27:42 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing numpy<2...
[INFO][Stream] 20.09.2024 09:27:42 [] (unknown:0) - Requirement already satisfied: numpy<2 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (1.26.1)
[INFO][Python] 20.09.2024 09:27:43 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing nibabel>=2.3.0...
[INFO][Stream] 20.09.2024 09:27:44 [] (unknown:0) - Requirement already satisfied: nibabel>=2.3.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (5.2.1)
[INFO][Stream] 20.09.2024 09:27:44 [] (unknown:0) - Requirement already satisfied: numpy>=1.20 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from nibabel>=2.3.0) (1.26.1)
[INFO][Stream] 20.09.2024 09:27:44 [] (unknown:0) - Requirement already satisfied: packaging>=17 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from nibabel>=2.3.0) (23.2)
[INFO][Python] 20.09.2024 09:27:44 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing tqdm>=4.45.0...
[INFO][Stream] 20.09.2024 09:27:45 [] (unknown:0) - Requirement already satisfied: tqdm>=4.45.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (4.66.5)
[INFO][Python] 20.09.2024 09:27:45 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing p-tqdm...
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: p-tqdm in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (1.4.2)
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: tqdm>=4.45.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from p-tqdm) (4.66.5)
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: pathos>=0.2.5 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from p-tqdm) (0.3.2)
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: six>=1.13.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from p-tqdm) (1.16.0)
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: ppft>=1.7.6.8 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from pathos>=0.2.5->p-tqdm) (1.7.6.8)
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: dill>=0.3.8 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from pathos>=0.2.5->p-tqdm) (0.3.8)
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: pox>=0.3.4 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from pathos>=0.2.5->p-tqdm) (0.3.4)
[INFO][Stream] 20.09.2024 09:27:46 [] (unknown:0) - Requirement already satisfied: multiprocess>=0.70.16 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from pathos>=0.2.5->p-tqdm) (0.70.16)
[INFO][Python] 20.09.2024 09:27:46 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing xvfbwrapper...
[INFO][Stream] 20.09.2024 09:27:47 [] (unknown:0) - Requirement already satisfied: xvfbwrapper in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (0.2.9)
[INFO][Python] 20.09.2024 09:27:48 [Python] (/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py:595) - - Installing rt-utils...
[INFO][Stream] 20.09.2024 09:27:48 [] (unknown:0) - Collecting rt-utils
[INFO][Stream] 20.09.2024 09:27:48 [] (unknown:0) -   Obtaining dependency information for rt-utils from https://files.pythonhosted.org/packages/84/f7/4212ac81d23733a79415dc0cc8c7d0d795ca025d5cdb34d1887a0402a6cb/rt_utils-1.2.7-py2.py3-none-any.whl.metadata
[INFO][Stream] 20.09.2024 09:27:48 [] (unknown:0) -   Using cached rt_utils-1.2.7-py2.py3-none-any.whl.metadata (7.5 kB)
[INFO][Stream] 20.09.2024 09:27:48 [] (unknown:0) - Requirement already satisfied: pydicom in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from rt-utils) (2.4.3)
[INFO][Stream] 20.09.2024 09:27:48 [] (unknown:0) - Requirement already satisfied: numpy in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from rt-utils) (1.26.1)
[INFO][Stream] 20.09.2024 09:27:49 [] (unknown:0) - Collecting opencv-python (from rt-utils)
[INFO][Stream] 20.09.2024 09:27:49 [] (unknown:0) -   Using cached opencv-python-4.10.0.84.tar.gz (95.1 MB)
[INFO][Stream] 20.09.2024 09:27:55 [] (unknown:0) -   Installing build dependencies: started
[INFO][Stream] 20.09.2024 09:28:06 [] (unknown:0) -   Installing build dependencies: finished with status 'done'
[INFO][Stream] 20.09.2024 09:28:07 [] (unknown:0) -   Getting requirements to build wheel: started
[INFO][Stream] 20.09.2024 09:28:07 [] (unknown:0) -   Getting requirements to build wheel: finished with status 'done'
[INFO][Stream] 20.09.2024 09:28:07 [] (unknown:0) -   Preparing metadata (pyproject.toml): started
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) -   Preparing metadata (pyproject.toml): finished with status 'done'
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) - Collecting dataclasses (from rt-utils)
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) -   Obtaining dependency information for dataclasses from https://files.pythonhosted.org/packages/26/2f/1095cdc2868052dd1e64520f7c0d5c8c550ad297e944e641dbf1ffbb9a5d/dataclasses-0.6-py3-none-any.whl.metadata
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) -   Using cached dataclasses-0.6-py3-none-any.whl.metadata (3.0 kB)
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) - Using cached rt_utils-1.2.7-py2.py3-none-any.whl (18 kB)
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) - Using cached dataclasses-0.6-py3-none-any.whl (14 kB)
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) - Building wheels for collected packages: opencv-python
[INFO][Stream] 20.09.2024 09:28:08 [] (unknown:0) -   Building wheel for opencv-python (pyproject.toml): started
...
...
...
[INFO][Stream] 20.09.2024 10:00:41 [] (unknown:0) -       [  0%] Built target opencv_dnn_plugins
[INFO][Stream] 20.09.2024 10:00:41 [] (unknown:0) -       [  0%] Built target opencv_highgui_plugins
...
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       [ 99%] Linking CXX static library ../../lib/libopencv_gapi.a
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       /Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../lib/libopencv_gapi.a(gtbbexecutor.cpp.o) has no symbols
...
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       [ 99%] Built target opencv_gapi
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       [ 99%] Generate files for Python bindings and documentation
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       Note: Class cv::Feature2D has more than 1 base class (not supported by Python C extensions)
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -             Bases:  cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -             Only the first base class will be used
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       Note: Class cv::detail::GraphCutSeamFinder has more than 1 base class (not supported by Python C extensions)
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -             Bases:  cv::detail::GraphCutSeamFinderBase, cv::detail::SeamFinder
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -             Only the first base class will be used
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       [ 99%] Built target gen_opencv_python_source
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       [ 99%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       In file included from /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-install-fhss2s9r/opencv-python_b944e47b429d46758eda51e823b82402/opencv/modules/python/src2/cv2.cpp:5:
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-install-fhss2s9r/opencv-python_b944e47b429d46758eda51e823b82402/opencv/modules/python/src2/cv2.hpp:23:10: fatal error: 'Python.h' file not found
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       #include <Python.h>
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -                ^~~~~~~~~~
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       1 error generated.
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       make: *** [all] Error 2
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       Traceback (most recent call last):
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -         File "/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-6_j_vbk0/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 668, in setup
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -           cmkr.make(make_args, install_target=cmake_install_target, env=env)
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -         File "/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-6_j_vbk0/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 696, in make
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -           self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -         File "/private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-6_j_vbk0/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 741, in make_impl
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -           raise SKBuildError(msg)
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       An error occurred while building with CMake.
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -         Command:
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -           /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-build-env-6_j_vbk0/overlay/lib/python3.9/site-packages/cmake/data/bin/cmake --build . --target install --config Release --
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -         Install target:
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -           install
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -         Source directory:
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -           /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-install-fhss2s9r/opencv-python_b944e47b429d46758eda51e823b82402
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -         Working directory:
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -           /private/var/folders/5y/nyrtn1qx1pq81bdg8l9tzck80000gn/T/pip-install-fhss2s9r/opencv-python_b944e47b429d46758eda51e823b82402/_skbuild/macosx-11.0-x86_64-3.9/cmake-build
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       Please check the install target is valid and see CMake's output for more information.
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -       [end of output]
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -   note: This error originates from a subprocess, and is likely not a problem with pip.
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) -   ERROR: Failed building wheel for opencv-python
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) - Failed to build opencv-python
[INFO][Stream] 20.09.2024 10:00:42 [] (unknown:0) - ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
[ERROR][Python] 20.09.2024 10:00:46 [Python] (/Applications/Slicer.app/Contents/bin/Python/slicer/util.py:3009) - Failed to upgrade TotalSegmentator

Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '-m', 'pip', 'install', 'rt-utils']' returned non-zero exit status 1.
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 319, in onPackageUpgrade
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -     self.logic.setupPythonRequirements(upgrade=True)
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 789, in setupPythonRequirements
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -     skippedRequirements = self.pipInstallSelective(
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py", line 706, in pipInstallSelective
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -     slicer.util.pip_install(requirement)
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3887, in pip_install
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -     _executePythonModule("pip", args)
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3848, in _executePythonModule
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -     logProcessOutput(proc)
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -   File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3814, in logProcessOutput
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) -     raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
[CRITICAL][Stream] 20.09.2024 10:12:54 [] (unknown:0) - subprocess.CalledProcessError: Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '-m', 'pip', 'install', 'rt-utils']' returned non-zero exit status 1.

It’s unclear why it picked opencv-python’s source file. PyPI hosts a whl file that could be used:
image

Clearing the pip cache could potentially force it to try and pull the whl file. Alternatively you can download the whl file manually and tell pip to install the path to the whl.

Maybe opencv-python does not have wheel for this specific linux distribution. Anyway, OpenCV is messy and it is not needed, so the best is to just not install it.

The TotalSegmentator extension that you download today will no longer attempt to install opencv-python, so it should be all good. To get this updated version:

  • use the latest Slicer Stable Release (or download the latest Slicer Preview Release today - the preview release that you may have downloaded yesterday or earlier will not have the latest extension updates)
  • reinstall the TotalSegmentator extension.

Apologies, the user appears to be on macOS 11 where that latest opencv-python version has a macOS 11+ whl but only on Apple Silicon. If this was an Intel mac, then it needs macOS 12+.
{EDE3F05C-9B07-4F93-8B07-008F70B7673D}

Thank you all for your help. After updating to macOS Ventura 13.7, it worked.

1 Like