Fmriprep cannot run: different issues when using different versions

Hi everyone,

I am trying to run fmriprep on the server. The fmriprep is installed with this singularity command:

singularity build /my_images/fmriprep-<version>.simg docker://poldracklab/fmriprep:<version>

With version 1.2.5 or 1.2.6, fmriprep is not able to recognize the bids data folder, though I have validated the bids data online.

Making sure the input data is BIDS compliant (warnings can be ignored in most cases).
/projects/bids_data does not exist
Traceback (most recent call last):
File “/usr/local/miniconda/bin/fmriprep”, line 11, in
sys.exit(main())
File “/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py”, line 354, in main
validate_input_dir(exec_env, opts.bids_dir, opts.participant_label)
File “/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py”, line 535, in validate_input_dir
subprocess.check_call([‘bids-validator’, bids_dir, ‘-c’, temp.name])
File “/usr/local/miniconda/lib/python3.7/subprocess.py”, line 341, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘bids-validator’, ‘/projects/bids_data’, ‘-c’, ‘/tmp/tmp9el0m4nj’]’ returned non-zero exit status 2.
Sentry is attempting to send 1 pending error messages
Waiting up to 2.0 seconds
Press Ctrl-C to quit

I tried to install 1.1.6 instead, and fmriprep gave me a different error message for not being able to find the freesurfer license. I have tried either to use “–fs-license-file” or set up “FS_LICENSE” in .bashrc (which echos correctly), but fmriprep still gave me the same error.

/usr/local/miniconda/lib/python3.6/site-packages/bids/grabbids/init.py:6: FutureWarning: grabbids has been renamed to layout in version 0.6.5, and will be removed in version 0.8
warnings.warn(“grabbids has been renamed to layout in version 0.6.5, and will be removed in version 0.8”, FutureWarning)
Traceback (most recent call last):
File “/usr/local/miniconda/bin/fmriprep”, line 11, in
sys.exit(main())
File “/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py”, line 264, in main
'ERROR: a valid license file is required for FreeSurfer to run. ’
RuntimeError: ERROR: a valid license file is required for FreeSurfer to run. FMRIPREP looked for an existing license file at several paths, in this order: 1) command line argument --fs-license-file; 2) $FS_LICENSE environment variable; and 3) the $FREESURFER_HOME/license.txt path. Get it (for free) by registering at https://surfer.nmr.mgh.harvard.edu/registration.html

I am really running out of ideas of what went wrong in the set up. Not even sure if it’s related, but do I have to install the docker locally?

Any suggestions will be wonderful. Thank you!

btw, just in case it is helpful, here is the tree for my bids folder:

bids_data/
├── dataset_description.json
├── dir-AP_epi.json
├── dir-PA_epi.json
├── sub-01
│ ├── anat
│ │ ├── sub-01_T1w.json
│ │ ├── sub-01_T1w.nii.gz
│ │ ├── sub-01_T2w.json
│ │ └── sub-01_T2w.nii.gz
│ ├── fmap
│ │ ├── sub-01_dir-AP_epi.json
│ │ ├── sub-01_dir-AP_epi.nii.gz
│ │ ├── sub-01_dir-PA_epi.json
│ │ └── sub-01_dir-PA_epi.nii.gz
│ └── func
│ ├── sub-01_task-instruct_events.tsv
│ ├── sub-01_task-instruct_run-01_bold.json
│ ├── sub-01_task-instruct_run-01_bold.nii.gz
│ ├── sub-01_task-instruct_run-02_bold.json
│ ├── sub-01_task-instruct_run-02_bold.nii.gz
│ ├── sub-01_task-instruct_run-03_bold.json
│ ├── sub-01_task-instruct_run-03_bold.nii.gz
│ ├── sub-01_task-instruct_run-04_bold.json
│ ├── sub-01_task-instruct_run-04_bold.nii.gz
│ ├── sub-01_task-instruct_run-05_bold.json
│ ├── sub-01_task-instruct_run-05_bold.nii.gz
│ ├── sub-01_task-instruct_run-06_bold.json
│ ├── sub-01_task-instruct_run-06_bold.nii.gz
│ ├── sub-01_task-instruct_run-07_bold.json
│ ├── sub-01_task-instruct_run-07_bold.nii.gz
│ ├── sub-01_task-instruct_run-08_bold.json
│ └── sub-01_task-instruct_run-08_bold.nii.gz
├── task-instruct_bold.json
└── tmp_dcm2bids

Most likely you need to manually bind folders between host system and the container. See the second “Note” at https://fmriprep.readthedocs.io/en/stable/installation.html#running-a-singularity-image

Hi Chris,

Thanks for the reply! I have seen that before, but what does the host folder mean on that page? Sorry if this is a silly question.

Thanks!!

This might clarify things further https://www.sylabs.io/guides/3.0/user-guide/bind_paths_and_mounts.html

Hi Chris,

Thanks for the website! I have tried to mount the whole path for the folder containing the container and itself (~/projects/container:/container). But I am still having the same error. Also, is it weird that I don’t have this issue when I am using older version? (though the older version have another issue for the freesurfer license).

The structure of the folders are like the following:

projects/
├── container
│ ├── fmriprep
├── projectName
│ ├── bids_data

Here’s how you can easily test path binds:

singularity exec /my_images/fmriprep-1.2.6.simg ls /projects/bids_data

For example:

singularity exec -B /my_data:/projects/bids_data  /my_images/fmriprep-1.2.6.simg ls /projects/bids_data

PS The error about FreeSurfer license is also most likely caused by an issue with folder mapping.

Hi Chris,

Thank you! This error has disappeared now! Thanks again for your help!