TotalSegmentator installation seems alright but the inferencing is not working.
OS: MacOS
TotalSegmentator installation seems alright but the inferencing is not working.
OS: MacOS
rMITK MITK | |||
Restricted Differential Revision | rMITK70ae170a1633 Totalsegmentator urllib dependency pinning | ||
Restricted Differential Revision | rMITKb8a6c48b3f0c Anticipatory Totalsegmentator urllib dependency pinning |
Status | Assigned | Task | ||
---|---|---|---|---|
Open | None | T29191 [SEG] New segmentation tool candidates | ||
Open | None | T29437 [SEG] Add TotalSegmentator | ||
Resolved | a178n | T29567 TotalSeg: inferencing issue on MacOS |
Log shows:
TotalSegmentator -i /tmpmitk-AQVb2K/totalseg-in-QOuAM7/EkysIV_000_0000.nii.gz -o /tmpmitk-AQVb2K/totalseg-out-2CpWaL/EkysIV_000.nii.gz --ml --fast /Users/ashis/Library/Application Support/DKFZ/.totalsegmentator/bin
#8.502# ERROR: Traceback (most recent call last): File "/Users/ashis/Library/Application Support/DKFZ/.totalsegmentator/bin/TotalSegmentator", line 8, in <module> #8.502# ERROR: from totalsegmentator.python_api import totalsegmentator File "/Users/ashis/Library/Application Support/DKFZ/.totalsegmentator/lib/python3.9/site-packages/totalsegmentator/python_api.py", line 11, in <module> from totalsegmentator.libs import download_pretrained_weights File "/Users/ashis/Library/Application Support/DKFZ/.totalsegmentator/lib/python3.9/site-packages/totalsegmentator/libs.py", line 13, in <module> import requests File "/Users/ashis/Library/Application Support/DKFZ/.totalsegmentator/lib/python3.9/site-packages/requests/__init__.py", line 43, in <module> #8.503# ERROR: import urllib3 File "/Users/ashis/Library/Application Support/DKFZ/.totalsegmentator/lib/python3.9/site-packages/urllib3/__init__.py", line 38, in <module> #8.503# ERROR: raise ImportError( ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168
It seems urllib3 package, a dependency of Totalsegmentator had a version bump yesterday rendering it unusable on MacOS. Its error message clearly shows it as a known issue.
The only solution is to downgrade the version.
This is not an MITK problem, until now we had let TotalSegmentator (implicitly, PyPI) handle the dependency resolution. From this experience, I think we cannot let it happen and take things into our own hands and install the main dependencies ourselves, Currently, we only explicitly handle Pytorch and scipy installation. This should be extended to more packages like urllib3, an HTTP client for Python.
Otherwise, we are always at the risk of TotalSegmentator breaking down in production by no mistake of our own.
I think it would be more efficient /sufficient to advise @wasserth to use explicitly defined versions for total segmentator dependencies. That is something all projects should regard for productive versions to have a better control on their supply chain.
I would also open an issue at GitHub. As you already analyzed the current versions, we could also think of providing a pull request (and have the fork with that changes as back up plan for the release).
Status: Issue is fixed. I tested it on macOS with python 3.9 & it works. However, it's not yet on pypi. Until the changes are on pypi, MITK won't benefit from the fix. MITK pip installs TotalSegmentator.