FreeSurfer license file error in fMRIprep 1.0.0-rc10

What was the RUNNING: command when FS_LICENSE was set?

Ah, Looking at the RUNNING: command I now realize the issue. I figured I had missed something. However, it appears that I hadn’t completely solved my license issue by setting a new path, as I’ve now replaced the initial ‘RuntimeError: ERROR: when --no-freesurfer is not set, a valid license file is required for FreeSurfer to run’ with a new license error that doesn’t pop up for some time:
‘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’
Not sure why I am getting this one.

I should add that I have obtained a brand new license and double checked that it was put into the correct folder.

It looks like you’re using fmriprep 1.0.0. Is there any reason you can’t upgrade to the latest? pip install --upgrade fmriprep-docker

I believe I have the latest version. When I run pip installer, I get this message:

“Requirement already up-to-date: fmriprep-docker in ./.local/lib/python2.7/site-packages (1.1.8)”

Okay. The reason I ask is that the RUNNING line indicates that you’re using version 1.0.0, which should only happen with fmriprep-docker 1.0.0 (each version defaults to the Docker image with the same version number).

Additionally, this is an old error:

A valid FreeSurfer license is required to run fMRIPrep at all, as we depend on FreeSurfer tools at several points, even when recon-all is not run.

So it’s unclear to me what is happening at this point. Can you please run each of the following, and in both cases report back the RUNNING line, and any error that you may be getting?

a) fmriprep-docker --fs-license-file $HOME/.licenses/freesurfer/license.txt /path/to/data/dir /path/to/output/dir participant
b) FS_LICENSE=$HOME/.licenses/freesurfer/license.txt fmriprep-docker /path/to/data/dir /path/to/output/dir participant

These should produce identical RUNNING lines, and either should work correctly.

Ah, I see. The miscommunication was completely on my end, as I was using the documentation from the fmriprep website to illustrate the method I was using. When running a) I get the following

'RUNNING: docker run --rm -it -v /home/cbuckland/.freesurfer-license.txt:/opt/freesurfer/license.txt:ro -v /mnt/Data/human_data/Subjects:/data:ro -v /mnt/Data/Processed/human_processed/sub-01:/out poldracklab/fmriprep:1.1.8 /data /out participant
/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)
/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)
181011-19:11:48,799 nipype.workflow IMPORTANT:

Running fMRIPREP version 1.1.8:
  * BIDS dataset path: /data.
  * Participant list: ['01'].
  * Run identifier: 20181011-191148_3932bd0c-1e00-4767-bcc1-b0b0ec0aac70.'

I will run the second line and get back to you asap.

When running b) I get:
'RUNNING: docker run --rm -it -v /home/cbuckland/usr/local/freesurfer/license.txt:/opt/freesurfer/license.txt:ro -v /mnt/Data/human_data/Subjects:/data:ro -v /mnt/Data/Processed/human_processed/sub-01:/out poldracklab/fmriprep:1.1.8 /data /out participant
/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)
/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)
181011-20:46:19,272 nipype.workflow IMPORTANT:

Running fMRIPREP version 1.1.8:
  * BIDS dataset path: /data.
  * Participant list: ['01'].
  * Run identifier: 20181011-204619_afdbe035-fab5-45ba-aa5f-7be5b79b7c8d."

One issue may be that freesurfer was previously installed by another user to usr/local/freesurfer. Could it be a permissions issue?

I’m seeing the following files being used:

a) /home/cbuckland/.freesurfer-license.txt
b) /home/cbuckland/usr/local/freesurfer/license.txt

Are you not using $HOME/.licenses/freesurfer/license.txt in both cases? Do either of these files exist?

Apologies, there was an issue with the command that I included in my previous messages. Here is what I get when using $HOME/.licenses/freesurfer/license.txt:

RUNNING: docker run --rm -it -v /home/cbuckland/.licenses/freesurfer/license.txt:/opt/freesurfer/license.txt:ro -v /mnt/Data/human_data/Subjects:/data:ro -v /mnt/Data/Processed/human_processed/sub-01:/out poldracklab/fmriprep:1.1.8 /data /out participant
/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)
/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)
181011-21:15:18,541 nipype.workflow IMPORTANT:

Running fMRIPREP version 1.1.8:
  * BIDS dataset path: /data.
  * Participant list: ['01'].
  * Run identifier: 20181011-211518_6fd37faa-4b09-4861-96d4-135d90db9b0d.

To clarify, I’m getting the same error when using $HOME/.licenses/freesurfer/license.txt.
This is the exact command line I’m running:

fmriprep-docker --fs-license-file $HOME/.licenses/freesurfer/license.txt /mnt/Data/human_data/Subjects/ /mnt/Data/Processed/human_processed/sub-01 participant

And the running line it results in is as follows:

RUNNING: docker run --rm -it -v /home/cbuckland/.licenses/freesurfer/license.txt:/opt/freesurfer/license.txt:ro -v /mnt/Data/human_data/Subjects:/data:ro -v /mnt/Data/Processed/human_processed/sub-01:/out poldracklab/fmriprep:1.1.8 /data /out participant

Thank you for your help and patience with this. Not sure what I’ve done wrong.

Hello all,

I have a similar issue with fMRIprep not finding my fs license. Here is the command I use, followed by the error:

COMMAND:

docker run poldracklab/fmriprep /m/InProcess/3T/NABM/fMRI/BIDS/ -w /m/InProcess/3T/NABM/fMRI/work/ /m/InProcess/3T/NABM/fMRI/fMRIprep_output/ participant --participant-label 215 --skip_bids_validation --sloppy --ignore slicetiming --fs-license-file /opt/freesurfer/6.0.0/license.txt

ERROR:

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 362, 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
Sentry is attempting to send 1 pending error messages
Waiting up to 2.0 seconds

Not sure why it can’t find the license because it exists there. One thing to add, this is what the license looks like-- is this an issue:

-bash-4.2$ /opt/freesurfer/6.0.0/license.txt
/opt/freesurfer/6.0.0/license.txt: line 1: derek.flenniken@ucsf.edu: command not found
/opt/freesurfer/6.0.0/license.txt: line 2: 14374: command not found
/opt/freesurfer/6.0.0/license.txt: line 3: *CWZHWve87nIE: command not found
/opt/freesurfer/6.0.0/license.txt: line 4: FSUZ4O2LZr0eM: command not found

Thank you for the help.

Hi @atersakyan,

The problem here is that docker (and containers in general) run isolated in a sandbox, so they don’t have access to the host (in this case, your license file is under /opt/freesurfer/6.0.0 of the host).

To make the file available, you’ll need to mount some filesystem in the container, so that it can exchange information with the host. Therefore, you want to do:

docker run -v /opt/freesurfer/6.0.0/license.txt:/fslicense.txt:ro poldracklab/fmriprep /m/InProcess/3T/NABM/fMRI/BIDS/ -w /m/InProcess/3T/NABM/fMRI/work/ /m/InProcess/3T/NABM/fMRI/fMRIprep_output/ participant --participant-label 215 --skip_bids_validation --sloppy --ignore slicetiming --fs-license-file /fslicense.txt

As you can see, I’m using the -v option to mount the license file in the host into the container. Then, I provide fmriprep with the mountpoint I’ve just created in the container (/fslicense.txt). Docker correctly handles mounting both folders and files, and in this case we picked the file route.

At this point, you’ll be able to run fMRIPrep. Unless you made the path /m/InProcess/3T/NABM/fMRI available to the container with some implicit mechanism I’m not aware of, that path will not exist in the container. That’s where you’ll hit the next snag.

Therefore, you want to mount more directories so that the container can access the data and write results somewhere you can then retrieve them. I’d suggest something along these lines:

docker run -v /opt/freesurfer/6.0.0/license.txt:/fslicense.txt:ro \
           -v /m/InProcess/3T/NABM/fMRI/BIDS:/data:ro \
           -v /m/InProcess/3T/NABM/fMRI/fmriprep-1.3.2:/work \
           -w /work poldracklab/fmriprep:1.3.2 \
           /data out/ participant --participant-label 215 --skip_bids_validation --sloppy --ignore slicetiming --fs-license-file /fslicense.txt

Further comments:

  • using --skip_bids_validation is a really bad idea. Using --sloppy is an even worse idea.
  • you may want to check fmriprep’s documentation on Docker, Franklin’s tutorial and the official documentation of docker to make sure you are trying the right things
  • Make sure you always pin a version when running fmriprep (i.e. the :1.3.2 tag I sneaked into the command line example - poldracklab/fmriprep:1.3.2)

@oesteban Thank you for your help and the explanation about mounting. This was very helpful.

Hi. I have a freesurfer license question. I’m running fmriprep and everything is running fine, except that it seems to be looking in the wrong place for the license file. I specify it in the command line with:
–fs-license-file /public/apps/freesurfer/6.0.0/license.txt. However, in the error files, it seems to be looking in /public/apps/freesurfer/6.0.0/bin. I get a similar error with respect to the sources.csh file, which is in the main 6.0.0 folder and it’s looking in 6.0.0/bin. Any idea what’s going wrong?

Thanks.