No module named 'duecredit' during 't2smap_node'

Summary of what happened:

Hi all, I have been testing versions 21.0.1 and 23.1.3 with multi-echo data to determine the optimal combination of versions and options for my project. While using slightly different versions of fmriprep, I encountered a couple of issues regarding the t2smap_node and duecredit for (I guess) the tedana process. The following example is a significant instance, but there were also occurrences of out-of-memory errors during the same process.
I’m curious whether this issue is primarily due to a memory shortage or if there are specific adjustments I need to make. I’m considering utilizing the –low-mem option or switching the –me-t2s-fit-method to loglin . Any insights on this matter would be greatly appreciated!

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

singularity exec \
    --cleanenv --bind ${BIDS_DIR},${WORK_DIR},${FREESURFER_DIR} \
    $FMRIPREP_IMG fmriprep \
    $BIDS_DIR $OUTPUT_DIR participant --participant_label $PARTICIPANT_LABEL -w $WORK_DIR \
    --nprocs ${SLURM_CPUS_PER_TASK} \
    --nthreads ${SLURM_CPUS_PER_TASK} \
    --mem_mb 240000 \
    --write-graph \
    --dummy-scans 10 \
    --fd-spike-threshold 0.9 \
    --fs-no-reconall \
    --fs-license-file /optnfs/freesurfer/6.0.0/license.txt \
    --skip-bids-validation \
    --random-seed 42 \
    --skull-strip-fixed-seed \
    --me-output-echos \
    --resource-monitor \
    --bold2t1w-dof 9 

Version:

23.1.3

Environment (Docker, Singularity, custom installation):

Singularity

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

Yes, BIDS-formatted

Relevant log outputs (up to 20 lines):

Cmdline:
	t2smap -d /dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/unwarp_wf/_echoidx_0/merge/vol0000_unwarped_merged.nii.gz /dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/unwarp_wf/_echoidx_1/merge/vol0000_unwarped_merged.nii.gz /dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/unwarp_wf/_echoidx_2/merge/vol0000_unwarped_merged.nii.gz -e 13.2 31.45 49.7 --mask /dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/bold_t2smap_wf/dilate_mask/dilated_mask.nii.gz --fittype curvefit
Stdout:

Stderr:
	**Failed to import duecredit due to No module named 'duecredit'**
	INFO     t2smap:t2smap_workflow:234 Using output directory: /dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/bold_t2smap_wf/t2smap_node
	INFO     t2smap:t2smap_workflow:244 Loading input data: ['/dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/unwarp_wf/_echoidx_0/merge/vol0000_unwarped_merged.nii.gz', '/dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/unwarp_wf/_echoidx_1/merge/vol0000_unwarped_merged.nii.gz', '/dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/unwarp_wf/_echoidx_2/merge/vol0000_unwarped_merged.nii.gz']
	INFO     t2smap:t2smap_workflow:260 Using user-defined mask
	INFO     t2smap:t2smap_workflow:263 Computing adaptive T2* map
	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 't2star_map' trait of a T2SMapOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/bold_t2smap_wf/t2smap_node/T2starmap.nii.gz' <class 'str'> 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 400, in run
	    outputs = self.aggregate_outputs(runtime)
	  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 '/dartfs-hpc/scratch/f005bpz/fmriprepwork/fmriprep_23_1_wf/single_subject_11_wf/func_preproc_ses_2_task_movie_run_01_echo_1_wf/bold_t2smap_wf/t2smap_node/T2starmap.nii.gz' for output 't2star_map' of a T2SMap interface
1 Like

The “no module named ‘duecredit’” message is just a warning. The real issue here is that the T2* node was killed. My guess is that it’s a memory issue. Given that you’re using version 23.1.3, you can use --me-t2s-fit-method loglin for a less memory-intensive T2* estimation method. If you really want the nonlinear estimation that is the default, you can increase fMRIPrep’s allowed memory.

1 Like

For the memory trouble, this is an issue we’ve seen before, with the issue raised here, but haven’t tried the solution yet as the problem isn’t as clear as it should be. @handwerkerd and @tsalo can chime in if I’ve said something wrong.

For the duecredit problem, thats likely due to the older version as, to the best of my knowledge, that was removed.

Personally, I would switch to loglin as the potential benefits of the curvefit approach are likely to be minimal (and its sloooooow). It is technically more accurate, but for fMRI data with a few echoes it is unlikely to have a large benefit - the T2* estimates are often only minimally impacted and only in select regions of the brain. Small shifts in those estimates relate to small shifts in the weights - which mean even small impacts on the time series. I would not worry about it.

I don’t have opinions about various versions of fmriprep.

edit: spent to long editing, thanks @tsalo, you beat me to it.

1 Like

Hello Taylor, thank you for your quick reply!
Your extensive array of previous posts and comments has already provided me with tremendous assistance. I’m relieved to hear that the duecredit message is only a warning. I will proceed with attempting the loglin option.

Hi Logan, thank you for your prompt response and for referencing the earlier discussions.

I came across issue #856 earlier and it appears that I’m encountering a similar error with fmriprep 23.1.3.

Regarding the duecredit matter, the dependency was actually removed some time ago as you said. Despite this, when I run tedana (version 23.0.1) in my Conda environment to process multi-echo images after fmriprep, I keep running into the duecredit warning. I’m currently ignoring it, but I thought I’d give you a heads-up. @tsalo

Also, thank you for sharing your thoughts on loglin. I’m interested to see how much benefit I can gain from curvefit, even though it consumes a significant amount of memory and time. I’ll try with the loglin and provide updates here.

Hey @ByeolKLux , good to see you here!

What versions of tedana and mapca are you using?

IIRC we removed the warning from mapca a couple of months later than we did for tedana. In any case, using the latest version of both packages should definitely get rid of the warning message.

1 Like

Eneko, good to see you as well! :laughing:

I’m using tedana 23.0.3 and mapca 0.0.3.
Should I update the mapca? I’ve tried pip install mapca in my conda environment but it seems like it doesn’t update the version…?

It turns out we never really cut a release with those changes. I have just done so.

You may want to upgrade mapca to 0.0.4 to remove the duecredit warning message.