Troubleshooting

Common issues and solutions for MONAI Physio.

Installation Issues

CUDA Out of Memory

Problem: RuntimeError: CUDA out of memory

Solutions:

  1. Resample or crop the input image before running the workflow.

  2. Use --registration-method Greedy when CUDA is unavailable.

  3. Process fewer frames per run.

Process Killed During Registration (Host Out of Memory)

Problem: a run stops with a bare Killed and no traceback, typically just after a line of ICON finetuning output:

ICONLoss(all_loss=tensor(1.0676, device='cuda:0', ...), ...)
Killed

Cause: the Linux OOM killer, not CUDA. A GPU shortage raises a catchable RuntimeError: CUDA out of memory with a Python traceback; Killed is the shell reporting that the kernel sent SIGKILL because the machine ran out of host RAM.

Confirm it, and see how much was in use at the time:

dmesg | grep -i "killed process"

Read anon-rss in that line. It is the process’s own heap; if file-rss is near zero the memory was genuinely allocated, rather than reclaimable file cache.

Cause on WSL2: WSL2 caps its virtual machine at half the host’s RAM by default, so a 128 GB machine gives Linux only about 64 GB and the OOM killer fires at that ceiling rather than at the physical limit. Check what Linux actually sees:

grep MemTotal /proc/meminfo

Solutions:

  1. On WSL2, raise the ceiling in the Windows-side .wslconfig (in your user profile directory), then run wsl --shutdown and restart the distribution:

    [wsl2]
    memory=112GB
    swap=32GB
    
  2. Process fewer cases or frames per run. The cohort workflows cache every artifact they write, so a re-run resumes where it stopped rather than starting over.

  3. Coarsen the registration grid, which sets the size of the distance maps and displacement fields held during a registration.

CUDA Version Mismatch

Problem: torch.cuda.is_available() returning False, an OSError or ImportError from torch_scatter, or runtime messages indicating a CUDA library version conflict.

Cause: PyTorch is a CPU-only build or one the driver does not support, or torch-scatter or cuDSS was installed for a different PyTorch or CUDA version than the installed PyTorch.

Solution: In a fresh virtual environment, install PyTorch for your GPU first, then torch-scatter and cuDSS matching that PyTorch, then MONAI Physio, as in Installation. For example, with CUDA 12.8 PyTorch 2.11, which runs on Turing (compute capability 7.5) through Blackwell GPUs:

pip install torch==2.11.0 torchvision --index-url https://download.pytorch.org/whl/cu128
pip install torch-scatter --only-binary torch-scatter -f https://data.pyg.org/whl/torch-2.11.0+cu128.html
pip install nvidia-cudss-cu12
pip install monai-physio

To check the result:

python -c "import torch, torch_scatter; print(torch.__version__, torch.cuda.is_available())"

A version ending in +cpu, False, or an OSError from torch_scatter means PyTorch is not the intended CUDA build or torch-scatter does not match it; reinstall both as above. If you built torch-scatter from source, rebuild it with --no-cache-dir as in Building torch-scatter, so pip does not reuse a build made for a different PyTorch.

To check cuDSS, which prints the library MONAI Physio will load or names the wheel to install:

python -c "from monai_physio import WarpCuDssFactor; print(WarpCuDssFactor.find_library())"

Verify the active CUDA version before reinstalling:

nvidia-smi   # shows driver and CUDA version

Import Errors

Problem: ImportError: No module named 'itk'

Solution: Install the missing dependencies; pip keeps the installed PyTorch:

pip install monai-physio

Processing Issues

Script Restarts or Fails at Startup on Windows

Problem: RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase, or a script starts its pipeline over again, when it segments or registers.

Solution: Run the script’s work under an if __name__ == "__main__": guard. Segmenters (nnU-Net inside TotalSegmentator, NV-Segment) and PyTorch start worker processes; on Windows each worker re-imports the script, and without the guard that re-import runs the pipeline again. Every tutorial does this:

from monai_physio import SegmentChestTotalSegmentatorWithContrast

if __name__ == "__main__":
    segmenter = SegmentChestTotalSegmentatorWithContrast()
    ...

Poor Segmentation Quality

Problem: Segmentation masks are inaccurate

Solutions:

  1. Check if image is contrast-enhanced. Use SegmentChestTotalSegmentatorWithContrast instead of SegmentChestTotalSegmentator for contrast-enhanced studies:

    from monai_physio import (
        SegmentChestTotalSegmentatorWithContrast,
        WorkflowConvertImageToUSD,
    )
    
    workflow = WorkflowConvertImageToUSD(
        ...,
        segmentation_method=SegmentChestTotalSegmentatorWithContrast(),
    )
    
  2. Preprocess intensity, spacing, and field of view before invoking the workflow.

Registration Not Converging

Problem: Registration produces poor results

Solutions:

  1. Increase --registration-iterations for the heart-gated CT CLI.

  2. Try different method:

    monai-physio-convert-image-to-usd cardiac_4d.nrrd --registration-method Greedy
    
  3. Check image orientation and spacing

USD Issues

USD Not Animating

Problem: USD file loads but doesn’t animate

Solutions:

  1. Validate USD file:

    usdchecker model.usd
    

    usdchecker is not part of the usd-core package installed with MONAI Physio; it ships with the OpenUSD toolset, available pre-built from https://developer.nvidia.com/usd.

  2. Open the scene in an Omniverse Kit application, switch the viewport to the scene’s /World/Camera, and press Play; see Viewing USD Files.

  3. Verify that the generated USD contains time samples.

USD File Too Large

Problem: USD files are very large

Solutions:

  1. Reduce mesh complexity before USD export.

  2. Export fewer anatomy groups or fewer time points.

Performance Issues

Slow Processing

Problem: Processing takes too long

Solutions:

  1. Check that PyTorch is a CUDA build (see CUDA Version Mismatch above); a CPU build of torch makes every GPU step fail or crawl.

  2. Reduce --registration-iterations during exploratory runs.

  3. Run tutorial workflows with reduced frame counts where supported.

Getting Help

If you still have issues:

  1. Check FAQ

  2. Search GitHub Issues

  3. Open a new issue with:

    • Python version

    • CUDA version

    • Complete error message

    • Minimal code to reproduce