Fmriprep error: nipype.pipeline.engine.nodes.NodeExecutionError

Summary of what happened:

I got nipype.pipeline.engine.nodes.NodeExecutionError while running fmriprep. Do any of you know how to fix it? Thank you so much!

Command used (and if a helper script was used, a link to the helper script or the command generated):

/opt/conda/envs/fmriprep/bin/fmriprep /Shared/PBS_JiangLab/Bingfang/pilot/bidsdata /Shared/PBS_JiangLab/Bingfang/pilot/fmriprep participant --participant-label 01 --output-spaces MNI152NLin2009cAsym:res-2 --stop-on-first-crash --use-plugin /Shared/PBS_JiangLab/Bingfang/pilot/scripts/plugin.yml --ignore slicetiming --fs-license-file /Shared/PBS_JiangLab/Bingfang/code/license.txt --resource-monitor --low-mem --force-bbr --anat-only -w /Shared/PBS_JiangLab/Bingfang/pilot/workdir

Version:

23.1.4

Environment (Docker, Singularity, custom installation):

Singularity

Data formatted according to a validatable standard? Please provide the output of the validator:

File Path: Task scans should have a corresponding events.tsv file. If this is a resting state scan you can ignore this warning or rename the task to include the word “rest”.

Type:		Warning
File:		sub-01_task-number_run-1_bold.nii.gz
Location:		bidsdata/sub-01/func/sub-01_task-number_run-1_bold.nii.gz
Reason:		Task scans should have a corresponding events.tsv file. It can be included one of the following locations: /events.tsv, /task-number_events.tsv, /run-1_events.tsv, /task-number_run-1_events.tsv, /sub-01/sub-01_events.tsv, /sub-01/sub-01_task-number_events.tsv, /sub-01/sub-01_run-1_events.tsv, /sub-01/sub-01_task-number_run-1_events.tsv, /sub-01/func/sub-01_events.tsv, /sub-01/func/sub-01_task-number_events.tsv, /sub-01/func/sub-01_run-1_events.tsv, /sub-01/func/sub-01_task-number_run-1_events.tsv
Type:		Warning
File:		sub-01_task-number_run-2_bold.nii.gz
Location:		bidsdata/sub-01/func/sub-01_task-number_run-2_bold.nii.gz
Reason:		Task scans should have a corresponding events.tsv file. It can be included one of the following locations: /events.tsv, /task-number_events.tsv, /run-2_events.tsv, /task-number_run-2_events.tsv, /sub-01/sub-01_events.tsv, /sub-01/sub-01_task-number_events.tsv, /sub-01/sub-01_run-2_events.tsv, /sub-01/sub-01_task-number_run-2_events.tsv, /sub-01/func/sub-01_events.tsv, /sub-01/func/sub-01_task-number_events.tsv, /sub-01/func/sub-01_run-2_events.tsv, /sub-01/func/sub-01_task-number_run-2_events.tsv

======================================================

File Path: The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification.

Type:		Warning

======================================================

Relevant log outputs (up to 20 lines):

Node Name: fmriprep_23_1_wf.single_subject_01_wf.anat_preproc_wf.brain_extraction_wf.inu_n4
File: /Shared/PBS_JiangLab/Bingfang/pilot/fmriprep/sub-01/log/20230909-144303_ca8d7a02-5b79-4135-9724-b698f811045e/crash-20230909-190221-bingfhuang-inu_n4-a3e40891-5ddd-4568-8d92-4c3aabb715f1.txt
Working Directory: /Shared/PBS_JiangLab/Bingfang/pilot/workdir/fmriprep_23_1_wf/single_subject_01_wf/anat_preproc_wf/brain_extraction_wf/inu_n4
Inputs:
args:
bias_image:
bspline_fitting_distance: 200.0
bspline_order:
convergence_threshold: 1e-07
copy_header: True
dimension: 3
environ: {‘NSLOTS’: ‘8’}
histogram_sharpening:
input_image: [‘/Shared/PBS_JiangLab/Bingfang/pilot/workdir/fmriprep_23_1_wf/single_subject_01_wf/anat_preproc_wf/brain_extraction_wf/truncate_images/mapflow/_truncate_images0/sub-01_T1w_noise_corrected_maths.nii.gz’]
mask_image:
n_iterations: [50, 50, 50, 50]
num_threads: 8
output_image:
rescale_intensities: False
save_bias: False
shrink_factor: 4
weight_image:
Traceback (most recent call last):
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/plugins/legacymultiproc.py”, line 67, in run_node
result[“result”] = node.run(updatehash=updatehash)
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py”, line 527, in run
result = self._run_interface(execute=True)
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py”, line 1380, in _run_interface
result = self._collate_results(
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py”, line 1249, in _collate_results
for i, nresult, err in nodes:
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/utils.py”, line 94, in nodelist_runner
result = node.run(updatehash=updatehash)
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py”, line 527, in run
result = self._run_interface(execute=True)
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py”, line 645, in _run_interface
return self._run_command(execute)
File “/opt/conda/envs/fmriprep/lib/python3.10/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 _inu_n40.

Cmdline:
N4BiasFieldCorrection --bspline-fitting [ 200 ] -d 3 --input-image /Shared/PBS_JiangLab/Bingfang/pilot/workdir/fmriprep_23_1_wf/single_subject_01_wf/anat_preproc_wf/brain_extraction_wf/truncate_images/mapflow/_truncate_images0/sub-01_T1w_noise_corrected_maths.nii.gz --convergence [ 50x50x50x50, 1e-07 ] --output sub-01_T1w_noise_corrected_maths_corrected.nii.gz --shrink-factor 4
Stdout:

Stderr:
Killed
Traceback:
Traceback (most recent call last):
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py”, line 453, in aggregate_outputs
setattr(outputs, key, val)
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py”, line 330, in validate
value = super(File, self).validate(objekt, name, value, return_pathlike=True)
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py”, line 135, in validate
self.error(objekt, name, str(value))
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/base_trait_handler.py”, line 74, in error
raise TraitError(
traits.trait_errors.TraitError: The ‘output_image’ trait of a N4BiasFieldCorrectionOutputSpec instance must be a pathlike object or string representing an existing file, but a value of ‘/Shared/PBS_JiangLab/Bingfang/pilot/workdir/fmriprep_23_1_wf/single_subject_01_wf/anat_preproc_wf/brain_extraction_wf/inu_n4/mapflow/_inu_n40/sub-01_T1w_noise_corrected_maths_corrected.nii.gz’ was specified.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 398, in run
    runtime = self._post_run_hook(runtime)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/mixins/fixheader.py", line 127, in _post_run_hook
    outputs = self.aggregate_outputs(runtime=runtime).get_traitsfree()
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 460, in aggregate_outputs
    raise FileNotFoundError(msg)
FileNotFoundError: No such file or directory '/Shared/PBS_JiangLab/Bingfang/pilot/workdir/fmriprep_23_1_wf/single_subject_01_wf/anat_preproc_wf/brain_extraction_wf/inu_n4/mapflow/_inu_n40/sub-01_T1w_noise_corrected_maths_corrected.nii.gz'

When creating this crashfile, the results file corresponding
to the node could not be found.

Screenshots / relevant information:

Hi @Bingfang_Huang and welcome to neurostars!

Just to confirm, are you using the fmriprep-container code or running directly from singularity?

Also, does the error persist if you use a fresh working directory?

Best,
Steven

This is an unfortunate consequence of nipype’s reporting, that the issue was buried. N4BiasFieldCorrection was killed, likely due to memory limitations. How much memory was available to the pipeline?

Hi, thanks for your reply. I think you are correct! Afterwards, it works when I specify another queue with parallel processings of 24 cores. I used one core with about 266 G before.

Best,
Bingfang

Hi Steven. The problem that may be due to memory/power was solved. Thank your for helping.

Best,
Bingfang

Hi, im having an exact same issue in running fmriprep in docker. How did you re-set mem_mb in codes?
I’ll attach my fmriprep.sh for you to better understand my problem.
(fmriprep-docker/fmriprep.sh at main · OhJunYoung21/fmriprep-docker · GitHub)

Hi @dhwnsdyd21,

In your code, increase the value in line 5.

Best,
Steven

1 Like

Hi Steven, I am now studying basic fMRI analysis these days. However, this is my first time doin’ something as a researcher. I want to know more about fMRI and also I want to know how to use post-fMRIprep data in analysis. I found NI-edu in GitHub, would this might help me to understand fMRIprep? if not, do you have any recommendation?

In short, I want to know why do we have to preform fMRIprep and how can we use post-fMRIprep data.

Im from South Korea so there will be some grammatical error in this reply.

Best,
dhwnsdyd21

Hi @dhwnsdyd21,

You can look at the fmriprep paper here: fMRIPrep: a robust preprocessing pipeline for functional MRI | Nature Methods

And a paper about using fmriprep outputs here: Analysis of task-based functional MRI data preprocessed with fMRIPrep | Nature Protocols

Best,
Steven

1 Like

Thanks!! Those articles looks rly helpful!

I don’t want to be rude but can I ask you few questions about there domains? I’m currently making models to predict certain disease or Sleep patterns. But Im not sure what I kind of jobs are available for me. Sometimes too much negative thinkings crush on me like ‘oh, these domain is hopeless in the future’.

Any advices would be appreciated.

Best,
dhwnsdyd21

Hi @dhwnsdyd21,

You should make a new post for further questions, as the main error in this post has already been solved.

Best,
Steven