Hi, I’ve been trying to use the Lung CT Analyzer extension with the AI segmentation ‘lung mask’, but I cannot get it to work. First, an error occurred that ‘torch was not present’, but I solved this by installing PyTorch extension in slicer (and then install pytorch via this module). However, afterwards I still get an error when I try to segment the lung.
First, when I press apply, I get a warning:
pytorch CUDA is not found on your system. The AI processing will last 3-10 minutes. Do you want to continue?
If I press OK, I will get the following error:
Failed to compute results: Command ‘[‘C:/Users/mmdeboer/AppData/Local/NA-MIC/Slicer 5.0.3/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘git+https://github.com/JoHof/lungmask’]’ returned non-zero exit status 1.
What do I have to do to solve this error? Thanks in advance!
Collecting git+https://github.com/JoHof/lungmask
Cloning GitHub - JoHof/lungmask: Automated lung segmentation in CT to c:\users\pagai\appdata\local\temp\pip-req-build-y_ut0tcq
ERROR: Error [WinError 2] The system cannot find the file specified while executing command git version
ERROR: Cannot find command ‘git’ - do you have ‘git’ installed and in your PATH?
[notice] A new release of pip available: 22.3 → 23.0
[notice] To update, run: python-real.exe -m pip install --upgrade pip
@rbumm It is important to note that users don’t have git installed on their system. You can install git relatively easily on Windows (see complete implementation here), but I don’t think there is no easy/standard solution that works on all linux and macOS configurations. It is easier to install from the zip file that github provides (as shown here) because then you don’t need git at all.
Note that the disadvantage of using git+https or git .zip format is that if the URL does not change (e.g., because you use the latest main version) then pip will just use the latest cached version. Therefore, instead of using a branch name, I would recommend to use a specific git hash, as it is done here.
All these issues are solved if the maintainer uploads a package to PyPI. If the maintainer of this package does not do it then you may enter an issue in the repository’s bugtracker to request this.
pip handles download, install, versioning, resolving version requirements, etc. pip_install will install the package according to the requirements that you specify. If you don’t specify any requirement then it just makes sure that some version of the package is installed. If you specify --upgrade then it’ll install the latest one. If you specify a version range then it’ll choose a version in that range.
Yes, if a Python package is already loaded then installing a new version will not change anything, as the Python scripts from the previous version are already loaded.
Note that pip_uninstall may fail if the Python package is in use and it contains shared libraries (DLLs). If you want to make uninstallation work, you would need to quit Slicer and run PythonSlicer -m pip uninstall ..., but often uninstalling while Slicer is running and then restarting is enough (and it is much easier to do than running some Python scripts outside Slicer). If Python package uninstallation was commonly needed then we could implement some mechanism to do it at Slicer application startup (before initializing Python, by launching the external PythonSlicer interpreter).
Hello everyone, I recently updated 3D slicer to the version 5.60 and when I’m trying to use the Lung CT Segmenter extension (which it was working before) I’m getting this error:
Failed to compute results: module ‘torch.backends’ has no attribute ‘mps’
I already checked the updates for PyTorch and the lungmask library, I even installed the version where it was working before (5.40) but even doing that it is not working and giving me the same error, what do you thinkg I can do…
Please report this error on the lungmask GitHub under issues. Can not reproduce that on a PC. The last version of lungmask obviously “adds support for mps (apple metal)”. If the problem can not be solved by the developer we will switch to an earlier version of lungmask.