Issue Running fmriprep with Singularity Image


This is my first attempt using fmriprep with a Singularity image, and I am running into an issue.

I’m running this on an HPC (Red Hat Enterprise Linux Server release 6.10 Santiago) that doesn’t allow Docker, so I’m using Singularity 2.5.2-dist.

Using the installation manual I prepared the image with the following:

singularity build $HOME/fmriprep-1.1.3.simg docker://poldracklab/fmriprep:1.1.3

I now have fmriprep-1.1.3.simg in my home directory, I then tried to run fmriprep on some of my BIDS-formatted data:

singularity run $HOME/fmriprep-1.1.3.simg \
$HOME/fMRI_data/ADM5/1032 $HOME/fMRI_data/ADM5 \
participant \
--participant-label sub-1032

I then receive this error message:
ERROR : Unknown image format/type: /N/u/dlevitas/Karst/fmriprep-1.1.3.simg
ABORT : Retval = 255

Thanks for the assistance.


@nikkibytes might be able to help you

Seems like

singularity build $HOME/fmriprep-1.1.3.simg docker://poldracklab/fmriprep:1.1.3

did not finish up happily.

Please, try again making sure the exit code is 0 (success). BTW, it could be a great time tu update to 1.1.4

singularity build $HOME/fmriprep-1.1.4.simg docker://poldracklab/fmriprep:1.1.4

Thank you for the help! I tried re-running with version 1.1.4, but after waiting for roughly an hour it didn’t seem to have finished. When I last checked it was showing this:

WARNING: Building container as an unprivileged user. If you run this container as root
WARNING: it may be missing some functionality.
Building Singularity image...

Does it commonly take awhile to build the image, or am I doing something wrong?

It is usually not as long as 1h. In the order of several minutes.

Hi Dan,

New reply on an old post… Did you ever resolve the “unknown image format” issue from last summer? I’m brand new to fmriprep and have run into the exact same problem on my HPC. In looking through the comments it seems like you never got a satisfactory answer. Thanks!


Hi @abw58,

Welcome to the community!

Ah yes, back then I think issue was that I wasn’t downloading the singularity container properly, nor calling fmriprep correctly. To download the most recent container, you can do something like:

export SINGULARITY_TMPDIR="/N/dc2/scratch/$(whoami)"
export SINGULARITY_CACHEDIR="/N/dc2/scratch/$(whoami)"
singularity build /N/dcwan/projects/irf/containers/fmriprep-1.5.0.simg docker://poldracklab/fmriprep:1.5.0\

And for my fmriprep call I do:

export SINGULARITYENV_TEMPLATEFLOW_HOME=/N/dcwan/projects/irf/templateflow

unset PYTHONPATH; singularity run -B /N/dcwan/projects/irf/templateflow:/opt/templateflow /N/dcwan/projects/irf/containers/fmriprep-1.5.0.simg \
		$bids_root_dir $bids_root_dir/derivatives						\
		participant														\
		--skip-bids-validation 											\
		--participant-label $s 											\
		--fs-license-file $FREESURFER_HOME/license.txt 					\
		--ignore slicetiming 											\
		--use-aroma 													\
		--aroma-melodic-dimensionality 100 								\
		--output-spaces T1w fsnative fsaverage MNI152NLin6Asym:res-2	\
		--nthread 8												\
		--fd-spike-threshold 0.5										\
		--dvars-spike-threshold 5 										\
		--stop-on-first-crash 											\
		--resource-monitor 												\
		--low-mem 														\
		--mem_mb 40000 												\
		--use-plugin $bids_root_dir/fmriprep_plugin_${s}.yml 			\
		--verbose 														\
		-w $bids_root_dir/derivatives

Haven’t had a “unknown image format” issue since, so things worked out. Hope this provides some guidance for getting fmriprep rolling.

1 Like

Thanks, Dan. This is very helpful. There was definitely an issue with setting up the singularity, which I believe I resolved with your code as I was able to build it successfully. However, I also got the warning “Building container as an unprivileged user. If you run this container as a root it may be missing some functionality”. Not sure if that will matter…

Would you mind briefly explaining what “export SINGULARITYENV_TEMPLATEFLOW_HOME=/N/dcwan/projects/irf/templateflow” is doing. It also looks like you are explicitly binding the singularity, can you also help me understand what you have in those 2 paths?

I’m obviously new to fmriprep and greatly appreciate the assistance!!

I’ve also had those warnings when installing containers. I believe it has to do with us not having root access on our HPCs, but regardless, it doesn’t affect anything, so fmriprep should work just fine.

Yes, so I forgot to mention templateflow, which is used with the newer versions of fmriprep. Essentially, it’s a repository of different templates that you can use to normalize your data to in the --output-spaces option.

To install templateflow, simply do:

pip install templateflow --user

which should place a templateflow directory in $HOME/.cache. However, I had an issue installing it here (see this post), but my solution worked and there aren’t any issues with templateflow.

The command export SINGULARITYENV_TEMPLATEFLOW_HOME is signifying where my templateflow directory is, so that it can be used by the fmriprep singularity container. You’ll notice in my example that one of my output spaces is MNI152NLin6Asym:res-2, which comes from templateflow (res-2 means I’m requesting the template with 2mm resolution).

Finally, the line unset PYTHONPATH; singularity run -B /N/dcwan/projects/irf/templateflow:/opt/templateflow /N/dcwan/projects/irf/containers/fmriprep-1.5.0.simg contains the paths to my templateflow and fmriprep singularity container. The rest is some miscellaneous stuff to get fmriprep started.