Totalsegmentator install fails due to certificate issue

This is mostly an issue on our end. I managed to download the zip archive from our end. Is there a way to manually install this?
@rbumm

Collecting https://github.com/wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /wasserth/TotalSegmentator/archive/b38eb449ad8652a987878a925203cbfa354e9b85.zip (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))


[notice] A new release of pip is available: 23.0 -> 23.0.1
[notice] To update, run: python-real.exe -m pip install --upgrade pip
[Python] Failed to compute results.
[Python] Command '['C:/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.
Traceback (most recent call last):
  File "C:/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:/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py", line 624, in setupPythonRequirements
    slicer.util.pip_install(self.totalSegmentatorPythonPackageDownloadUrl)
  File "C:\Slicer 5.2.2\bin\Python\slicer\util.py", line 3578, in pip_install
    _executePythonModule('pip', args)
  File "C:\Slicer 5.2.2\bin\Python\slicer\util.py", line 3540, in _executePythonModule
    logProcessOutput(proc)
  File "C:\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:/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.

No immediate idea - How did you install TotalSegmentator? From the Python Console or through the extension? You are using Linux?

İ installed via the extension manager (also putorch too). Pytorch threw a similar certificate error, so i downloaded the wheel and manually installed it. Pytorch works now. This is on windows.

Could you check this thread? Are you maybe having issues with firewall settings or antivirus software? Please try to connect to a different network or use a VPN

I have been discussing similar issue in a different post where I am also providing a small python snippet to help better understand.

Could you try the python snippet I provide in the following context ?

  • Python console built-in the Slicer application
  • PythonSlicer python console
  • Regular python console outside of the Slicer environment

Windows Powershell, same in Slicer 5.2.2

--------
Checking https://data.kitware.com
Checking https://data.kitware.com - OK
--------
Checking https://www.httpvshttps.com/
Checking https://www.httpvshttps.com/ - OK
--------
Checking https://slicer.org/
Checking https://slicer.org/ - OK
--------
Checking https://expired.badssl.com/
Checking https://expired.badssl.com/ - OK  [Expected <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)>]
--------
Checking https://github.com/
Checking https://github.com/ - OK`

As a workaround, you can download the package using a web browser (from the URL that is shown in the error message) and then then pip install that file.

1 Like

This is the output from python console inside the slicer

Checking https://data.kitware.com
Checking https://data.kitware.com - OK
--------
Checking https://www.httpvshttps.com/
Checking https://www.httpvshttps.com/ - OK
--------
Checking https://slicer.org/
Checking https://slicer.org/ - OK
--------
Checking https://expired.badssl.com/
Checking https://expired.badssl.com/ - OK  [Expected <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)>]
--------
Checking https://github.com/
Checking https://github.com/ - OK

@lassoan

I just retried and pip_install local zip file seemed to work this time.

But i encountered another issue. Upon invoking TotalSegmentator module, module wants to update the installation from original source (even through I installed the exact version). Of course this fails with the same certificate error as the extension based install.

Please check why the module wants to update. You should be able to see it from the stack trace but if it is not clear then you can attach Visual Studio Code’s debugger and step through the code.

1 Like

This is from the error message if it helps:

Traceback (most recent call last):
  File "C:\Slicer 5.2.2\bin\Python\slicer\util.py", line 2967, in tryWithErrorDisplay
    yield
  File "C:/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:/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py", line 624, in setupPythonRequirements
    slicer.util.pip_install(self.totalSegmentatorPythonPackageDownloadUrl)
  File "C:\Slicer 5.2.2\bin\Python\slicer\util.py", line 3578, in pip_install
    _executePythonModule('pip', args)
  File "C:\Slicer 5.2.2\bin\Python\slicer\util.py", line 3540, in _executePythonModule
    logProcessOutput(proc)
  File "C:\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:/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.

The version of TotalSegmentator is identified by the download URL because we need to install it by URL and not by version (because it is rarely updated on PyPI and version numbers of packages not on PyPI are unreliable).

You can disable the mechanism that installs the correct TotalSegmentator version by bypassing this check:

This will allow you to move a bit further.