Error running FMRIPREP from Singularity image

Hi all,

I’ve been trying to run fmriprep using a singularity image on Sherlock, and I keep getting this error:

subject_data, layout = collect_data(bids_dir, subject_id, task_id)
  File "/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/utils/bids.py$
    layout = BIDSLayout(dataset)
  File "/home/users/nvelez/.local/lib/python3.6/site-packages/grabbit/core.py",$
    **kwargs)
  File "/usr/local/miniconda/lib/python3.6/site-packages/bids/grabbids/bids_lay$
    dynamic_getters=True, **kwargs)
  File "/home/users/nvelez/.local/lib/python3.6/site-packages/grabbit/core.py",$
    self._load_domain(c)
  File "/home/users/nvelez/.local/lib/python3.6/site-packages/grabbit/core.py",$
    raise ValueError("Config file missing 'name' attribute.")
ValueError: Config file missing 'name' attribute.

Any tips on what’s causing this error? BIDS-validator didn’t find anything wrong with the dataset itself. For reference, I’m using fmriprep 1.0.8, and the exact command I’m using to run fmriprep within my sbatch script is:

singularity run $FMRIPREP_IMG \
        $BIDS_DIR $OUT_DIR participant \
        --participant-label $SUBJECT -w $WORKING_DIR \
        --nthreads 3 --mem-mb 8000

Thanks in advance!

Your local Python environment is being picked up, meaning the packaged versions of software are being ignored. If your singularity supports --clearenv, add the options --clearenv --fs-license-file $FS_LICENSE to your singularity command. If not, you can add PYTHONPATH="" to the beginning of your command (i.e. PYTHONPATH="" singularity run ...).

1 Like

It seems that your locally installed packages (in ~/.local) are interfering with contents of the container. This is a known “annoying” default of Singularity - it automounts your home folder. You can disable this behaviour with --contain. See http://singularity.lbl.gov/action-flags for more details. Mind that disabling automounting will disable all mounts including /scratch. You will have to mount them manually using -B.

1 Like

Thanks! This fixed the problem.

Follow-up question: fmriprep seemed to be running smoothly, but I got this error about two hours into preprocessing:

--------------------------------------------------------------------------
GNU libc version: 2.23
ERROR: Systems running GNU glibc version greater than 2.15
  require a newly formatted license file (it's free). Please
  download a new one from the following page:
  http://surfer.nmr.mgh.harvard.edu/registration.html
--------------------------------------------------------------------------
Linux sh-03-31.int 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 $

recon-all -s sub-04 exited with ERRORS at Fri May  4 18:02:18 UTC 2018

After seeing this error, I got a new Freesurfer license, but I’m not sure where to put it to fix this problem. Do I need to make changes to the Singularity image itself? Or is there anywhere in my local environment where I can place it?

My best bet is that since you started using --contain the folder where you store the freesurfer license is not available inside the container anymore. Make sure you use -B to mount that as well. You can also use the singularity shell command to explore what how the filesystem looks from the perspective of the container.

1 Like

You probably have a FreeSurfer 5 license. I guess getting a new one will just work :slight_smile:

Sorry, didn’t read it through.

As Singularity mounts your home folder by default, I usually store it in $HOME/.freesufer6.txt and then use the flag --fs-license-file $HOME/.freesurfer6.txt

1 Like

That worked—thanks! :slight_smile:

1 Like