Freesurfer License Error


I am trying to run a script using an Institution Server (Linux). Despite having my FreeSurfer License (for Linux) uploaded to the server, when I try to run the script, it fails and I receive this error:

Every user on the team has their own license, and the script points to the current user’s license.

It is hard for my team and I to pinpoint this issue, because other members have not experienced it when they run the same script. Is there a reason why the script would fail for me and not others?

Thank you so much!



I am guessing that the drive that contains your license wasn’t bound to your container when you ran fMRIPrep. What was your full command?


Hi Steven,

The single subject fmriprep script can be found here:

# === User input parameters ===
SUBJ=$1                                                                         # Read in from command line

BIDS_ROOT="/oak/stanford/groups/jzaki/scp_2022/bids"                            # Path to BIDS data
IMAGE=/"oak/stanford/groups/jzaki/zaki_images/fmriprep-20.2.1.simg"             # Path to singularity image
SURFER="/oak/stanford/groups/jzaki/zaki_images/FS_LICENSE.txt"                  # Path to FreeSurfer license
TFLOW="$HOME/.cache/templateflow"                                               # Path to templateflow sub-dir
mkdir -p $TFLOW                                                                 # Make templateflow dir if it doesn't exist

# === Run Singularity script ===
singularity run --home $HOME --cleanenv $IMAGE          \
  $BIDS_ROOT $BIDS_ROOT/derivatives                     \
  participant                                           \
  --participant-label $SUBJ                             \
  --task-id                                             \
      stressbuffer                                      \
  --md-only-boilerplate                                 \
  --fs-license-file $SURFER                             \
  --output-spaces                                       \
      MNI152NLin6Asym:res-2                             \
  --nthreads $THREADS                                   \
  --stop-on-first-crash                                 \
  --mem_mb $MEM                                         \
  --dummy-scans $DUMMY_SCANS

Are we missing an export somewhere? Thanks very much,

Yes, you should begin your singularity run with singularity run -B /oak and then include the rest of your call.

Good deal, thanks for your help!

1 Like

No problem, let me know if that fixes it for you!