Page MenuHomePhabricator

TotalSeg: inferencing issue on MacOS
Closed, ResolvedPublic

Description

TotalSegmentator installation seems alright but the inferencing is not working.

OS: MacOS

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

a178n triaged this task as Normal priority.May 5 2023, 11:03 AM
a178n created this task.

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
a178n renamed this task from TotalSeg: Install issue on MacOS to TotalSeg: inferencing issue on MacOS.May 5 2023, 11:26 AM
a178n raised the priority of this task from Normal to Unbreak Now!.May 5 2023, 1:32 PM

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.

This comment was removed by a178n.

Is @wasserth active here? Or we goto GitHub and make an issue over there?

Is @wasserth active here? Or we goto GitHub and make an issue over there?

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.

a178n added a revision: Restricted Differential Revision.May 15 2023, 12:07 AM

Fixed with D837

Deleted branch from rMITK MITK: feature/T29567-totalseg-macos-fix.