fMRIprep fails during preprocessing: anat_to_template_Warped.nii.gz file not found error

Summary of what happened:

After a lot of tweaking I managed to get fMRIprep up and running on a single example subject. It ran for about 30 minutes but then failed giving a “FileNotFoundError” referring to the file ‘/tmp/work/fmriprep_24_0_wf/sub_01_wf/anat_fit_wf/brain_extraction_wf/norm/anat_to_template_Warped.nii.gz’.

Does anyone know what it going on here and how to fix it?

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

fmriprep-docker /Users/me/ml_projects/fMRIprep/raw /Users/me/ml_projects/fMRIprep/raw/output participant --skip-bids-validation --fs-license-file  /Users/me/ml_projects/fMRIprep/license.txt

Version:

fMRIPrep v24.0.1

Environment (Docker, Singularity / Apptainer, custom installation):

fMRI prep is being run in Docker which was installed using “python -m pip install fmriprep-docker”
macOs Monterey
Macbook pro (16-inch 2019)
Processor 2,6 Ghz 6-Core intel Core I7
Memory 16 GB 2667 MHz DDR4
Startup Disk Macintosh HD

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

Bids validation resulted in no errors but did result in some warnings:

Warning 1: [Code 2] REPETITION_TIME_GREATER_THAN

Click here for more information about this issue
'RepetitionTime' is greater than 100 are you sure it's expressed in seconds?1 file
Warning 2: [Code 3] ECHO_TIME_GREATER_THAN

Click here for more information about this issue
'EchoTime' is greater than 1 are you sure it's expressed in seconds?1 file
Warning 3: [Code 13] SLICE_TIMING_NOT_DEFINED

Click here for more information about this issue
You should define 'SliceTiming' for this file. If you don't provide this information slice time correction will not be possible. 'Slice Timing' is the time at which each slice was acquired within each volume (frame) of the acquisition. Slice timing is not slice order -- rather, it is a list of times containing the time (in seconds) of each slice acquisition in relation to the beginning of volume acquisition.1 file
Warning 4: [Code 115] EMPTY_DATASET_NAME

Click here for more information about this issue
The Name field of dataset_description.json is present but empty of visible characters.
Warning 5: [Code 213] README_FILE_SMALL

Click here for more information about this issue
The recommended file /README is very small. Please consider expanding it with additional information about the dataset.

Relevant log outputs (up to 20 lines):

	 1DIAGNOSTIC,     7, -6.104555130005e-01, inf, 3.5196e+02, 2.5767e+01,
	 1DIAGNOSTIC,     8, -6.129053831100e-01, inf, 3.7824e+02, 2.6279e+01,
	 1DIAGNOSTIC,     9, -6.150641441345e-01, inf, 4.0515e+02, 2.6912e+01,
	 1DIAGNOSTIC,    10, -6.169801354408e-01, inf, 4.3062e+02, 2.5465e+01,
Stderr:
	 file NULL does not exist .
	 file NULL does not exist .
	 file NULL does not exist .
	Killed
Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/nibabel/loadsave.py", line 100, in load
	    stat_result = os.stat(filename)
	                  ^^^^^^^^^^^^^^^^^
	FileNotFoundError: [Errno 2] No such file or directory: '/tmp/work/fmriprep_24_0_wf/sub_01_wf/anat_fit_wf/brain_extraction_wf/norm/anat_to_template_Warped.nii.gz'

	During handling of the above exception, another exception occurred:

	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/nipype/interfaces/base/core.py", line 397, in run
	    runtime = self._run_interface(runtime)
	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/niworkflows/interfaces/fixes.py", line 110, in _run_interface
	    _copyxform(
	  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/niworkflows/utils/images.py", line 79, in _copyxform
	    resampled = nb.load(out_image, mmap=False)
	                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/nibabel/loadsave.py", line 102, in load
	    raise FileNotFoundError(f"No such file or no access: '{filename}'")
	FileNotFoundError: No such file or no access: '/tmp/work/fmriprep_24_0_wf/sub_01_wf/anat_fit_wf/brain_extraction_wf/norm/anat_to_template_Warped.nii.gz'


fMRIPrep: Please report errors to https://github.com/nipreps/fmriprep/issues

Screenshots / relevant information:


Hi @Steve_Sizzou,

The Killed in the error log indicates your job ran out of memory. How much memory does docker have access to on your machine, and how much days are you trying to process per job? Can you trying raising the memory and running on less data as a test?

Best,
Steven

Thanks! Yeah it seems that it was related to a memory issue, and now the error has vanished. But now I have a new problem. fMRIprep runs for about 30 mins and then the terminal hangs and stops giving updates. According to the activity monitor docker is still taking up a lot of the memory, and the laptop is heating up the whole time so it seems to be doing something, but I can’t tell if it’s supposed to do this or if it’s stuck. Anyway this is probably worth raising in a new post! Thank you!

You might be interested in brainlife.io for cloud based neuroimaging preprocessing if this is pushing your local machine to its limits.

1 Like

Thanks for the tip. Eventually I’m planning to shift this to the university cluster (56 CPUs, 378GB RAM) but I want to test run it locally first. No doubt though I’ll have a whole new set of errors to debug once I get it onto the cluster haha

I’d suggest just starting to test with cluster if that’s where your final analysis will be.

1 Like

Wow, I’m amazed that brainlife.io is apparently free!?

1 Like