nipreps / mriqc

Automated Quality Control and visual reports for Quality Assessment of structural (T1w, T2w) and functional MRI of the brain
http://mriqc.readthedocs.io
Apache License 2.0
300 stars 132 forks source link

OSError: No command "mri_robust_template" found with MRIQC v 23.1.0 #1125

Closed julfou81 closed 1 year ago

julfou81 commented 1 year ago

What happened?

I have tried the new version (23.0.1) of MRIQC but I encountered the following error:

OSError: No command "mri_robust_template" found on host skylake103.cluster. Please check that the corresponding package is installed.

What command did you use?

singularity run --cleanenv -B /scratch/jsein/BIDS:/work \
 /scratch/jsein/my_images/mriqc-23.1.0.simg /work/$study  \
 /work/$study/derivatives/mriqc23p1 participant group --participant_label $subjs  --n_procs 12    \
   -w /work/temp_data23p1_${study}  --fd_thres 0.5  --verbose-reports

What version of the software are you running?

23.0.1

How are you running this software?

Singularity

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

230614-17:21:04,693 cli IMPORTANT:

    Running MRIQC version 23.1.0:
      * BIDS dataset path: /work/NEMO.
      * Output folder: /work/NEMO/derivatives/mriqc23.
      * Analysis levels: ['participant', 'group'].

230614-17:21:15,968 cli WARNING:
     IMPORTANT: Anonymized quality metrics (IQMs) will be submitted to MRIQC's metrics repository. Submission of IQMs can be disabled using the ``--no-sub`` argument. Please visit https://mriqc.readthedocs.io/en/latest/dsa.html to revise MRIQC's Data Sharing Agreement.
230614-17:22:22,436 nipype.workflow WARNING:
     Storing result file without outputs
230614-17:22:22,438 nipype.workflow WARNING:
     [Node] Error on "mriqc_wf.dwiMRIQC.dwi_reference_wf.epi_merge" (/work/temp_data23p1_NEMO/mriqc_wf/dwiMRIQC/dwi_reference_wf/_in_file_..work..NEMO..sub-pilote1..dwi..sub-pilote1_dir-AP_dwi.nii.gz/epi_merge)
230614-17:22:24,269 nipype.workflow ERROR:
     Node epi_merge.a0 failed to run on host skylake103.cluster.
230614-17:22:24,270 nipype.workflow ERROR:
     Saving crash info to /work/NEMO/derivatives/mriqc23/logs/crash-20230614-172224-jsein-epi_merge.a0-da3ec52e-c696-4c3f-895a-9740bf13016c.txt
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/mriqc/engine/plugin.py", line 60, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node epi_merge.

Cmdline:
    echo Only one time point!
Stdout:

Stderr:

Traceback:
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 752, in _run_interface
        raise IOError(
    OSError: No command "mri_robust_template" found on host skylake103.cluster. Please check that the corresponding package is installed.

Additional information / screenshots

MRIQC v23.0.0 worked well on this dataset. It seems here that it is the dwi workflow that fails. The dwi folder contains two dwi series, with the same b values, one acquired with phase encoding direction in A>P and the other in P>A, with 3 shells (b=300, b=1000 and b2000) with 7 additional b0.

araikes commented 1 year ago

I second this error.

julfou81 commented 1 year ago

I ran the same command on T1w, T2w and bold images only (with the -m T1w T2w bold argument) and everything went fine. It seems that the bug only affects the dwi workflow.

LuRoe7 commented 1 year ago

I experience exactly the same error using singularity!

araikes commented 1 year ago

@oesteban just a bump on this.

tpatpa commented 1 year ago

Same error for me (with diffusion data)..

Node: mriqc_wf.dwiMRIQC.dwi_reference_wf.epi_merge
Working directory: /tmp/work/mriqc_wf/dwiMRIQC/dwi_reference_wf/_in_file_..data..sub-MSEL01896..ses-compact3T01..dwi..sub-MSEL01896_ses-compact3T01_acq-axdti_rec-gncd_run-01_dwi.nii.gz/epi_merge

Node inputs:

args = <undefined>
auto_detect_sensitivity = True
average_metric = <undefined>
environ = {'OMP_NUM_THREADS': '1'}
fixed_timepoint = True
in_files = <undefined>
in_intensity_scales = <undefined>
initial_timepoint = 1
initial_transforms = <undefined>
intensity_scaling = True
no_iteration = True
num_threads = 1
out_file = mri_robust_template_out.mgz
outlier_sensitivity = <undefined>
scaled_intensity_outputs = <undefined>
subjects_dir = <undefined>
subsample_threshold = 200
transform_outputs = True

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/mriqc/engine/plugin.py", line 60, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node epi_merge.

Cmdline:
    echo Only one time point!
Stdout:

Stderr:

Traceback:
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 752, in _run_interface
        raise IOError(
    OSError: No command "mri_robust_template" found on host 31cac18634fc. Please check that the corresponding package is installed.
amrshadid commented 1 year ago

same error also for me. any solutions ?

effigies commented 1 year ago

It looks like MRIQC doesn't bundle most of freesurfer in its image. Would any commenters here be interested in opening a PR to add it? The fMRIPrep docker image could be a helpful template: https://github.com/nipreps/fmriprep/blob/master/Dockerfile

Or possibly extending https://github.com/nipreps/mriqc/blob/master/Dockerfile#L89 to pull in mri_robust_template would work.

oesteban commented 1 year ago

Yeah, I'm a bit on the fence - perhaps not using the niworkflows EPI reference calculation would be better. MRIQC doesn't really need a very sophisticated reference.

effigies commented 1 year ago

Why are you generating EPI references now? For MC?

oesteban commented 1 year ago

MC, plotting, spatial normalization to MNI, that I can think of quickly

effigies commented 1 year ago

I see. What if you do vanilla MC, generate the motion-corrected series and just take the median image for the downstream "reference"? Or is it important to have preprocessing-quality MC?

oesteban commented 1 year ago

That would be okay. The only reason why I would think of something a bit more complicated is ensuring synthstrip (which is currently not used, but the plan is to port to it) behaves robustly because the reference has more love in it.

oesteban commented 1 year ago

Since synthstrip is not used yet, I think we can have the vanilla option to start with

araikes commented 1 year ago

@oesteban, any updates on this? I have a large dataset that would definitely benefit from the DWI QC workflow if it can get up and running.

celprov commented 1 year ago

@oesteban we are running into the same issue with running MRIQC on our hcph-pilot data using singularity.

yibeichan commented 1 year ago

I ran into the same issue with 23.1.0 on HPC via slurm. do we have a solution here? Should I go back to use a lower version?

effigies commented 1 year ago

There are basically three possible solutions:

1) Add FreeSurfer to the Docker image (possibly filtering most out) and increase the build time significantly. 2) Upload mri_robust_template only to some host and install it in Docker. 3) Select/write a different EPI reference workflow/function.

The first two will also mean needing to handle injecting a FreeSurfer license file when running MRIQC, which we haven't needed to do before and has the potential to annoy users.

In any case, the limiting factor is developer time, so I suspect I speak for @oesteban in saying that help would be appreciated.

I've recently factored out some of an older BOLD reference workflow here: https://github.com/nipreps/fmriprep/blob/next/fmriprep/workflows/bold/reference.py

There's nothing BOLD-specific there, and this should work with diffusion. If someone wants to copy that workflow here (I would suggest into mriqc/workflows/diffusion/base.py, just above hmc_workflow) and update the docstring to be less BOLD-specific, that would probably be the fastest path forward. You would then be replacing this node:

https://github.com/nipreps/mriqc/blob/f360d1eb46909626c4ca9dbeb5514c3d8fab29e7/mriqc/workflows/diffusion/base.py#L141-L145

And you would need to update any connection involving dwi_reference_wf in this connection statement:

https://github.com/nipreps/mriqc/blob/f360d1eb46909626c4ca9dbeb5514c3d8fab29e7/mriqc/workflows/diffusion/base.py#L200-L214

yibeichan commented 1 year ago

thanks @effigies! so we are leaning towards solution 3, right? I can work on it and see you in a PR (hopefully) soon

effigies commented 1 year ago

Yes, please do!

jennan commented 1 year ago

Hello,

I encountered the same issue. As a temporary fix, I have built an Apptainer container with MRIQC + Freesurfer (for mri_robust_template) + MRtrix3 (for dwidenoise). It's available on dockerhub and can be pulled using

apptainer pull mriqc.sif "oras://docker.io/maximerio/mriqc:v1.0.0"

Note: tag is the version of the github repo where the definition file is, not MRIQC, which is 23.1.0.

It should work the same with Singularity but I haven't tried it.

Please note the container is quite big :sweat_smile: (13 Gb).

I used it to run MRIQC with dwi and T1w modalities and, to my great surprise, did not ask for any Freesurfer license at any point (Freesurfer is installed using the .deb package).

I hope this can be of use to other people :slightly_smiling_face:.

effigies commented 1 year ago

This will be fixed in the next release.