I am trying to preprocess data using fMRIPrep, but have been getting an error indicating that a valid Freesurfer license is required, despite the fact that I have a Freesurfer license.
Any idea how I might go about resolving this issue? Any suggestions or help would be greatly appreciated. And please let me know if you need additional information.
Linux HPC (moderator note - but how? sinuglarity, docker, etc?)
Data formatted according to a validatable standard? Please provide the output of the validator:
PASTE VALIDATOR OUTPUT HERE
Relevant log outputs (up to 20 lines):
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
In the future please use the prepopulated Software Support post template for these questions, which prompts you to give us important information to help us debug. I have done my best to reorganize your post accordingly but didn’t have enough information for everything.
It is not clear what fMRIPrep version you are using or how you are running it (e.g. Singularity vs. Docker vs. bare-metal Python). Knowing this will help us debug. We recommend using containers. If using a container, please provide the full command, including the singularity run / docker run preamble.
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
In the future please format your code with tickmarks / the </> button for readability. You can see I edited your above post for you this time.
I recommend using singularity run / apptainer run syntax. Also you should use a working directory that is outside bids_dir. It’s likely that your syntax did not bind any important files like the license to the container so it couldn’t find it.
It was just suggested that I try copying the Freesurfer license to my $HOME directory, export that, and then try running, and surprisingly that seemed to work.
It looks like the pipeline is running past the previous point where it was crashing and I don’t see any license errors, so it seems that this specific issue is resolved.
Thank you for the container suggestion and providing feedback!
Yes, containers bind home directory by default, unless you include --contain-all. I generally recommend including --contain-all and not mounting home directory, because you could unknowingly introduce software conflicts with anything you have installed in home directory. It is also in general less portable/sustainable if you rely on user specific home directories.