Freesurfer license file not recognized as a file

I’m using the latest version of fmriprep (not the fmriprep-docker wrapper), and I’ve run into a problem where I mounted the license file into the docker container, but when I reference it using the --fs-license-file argument, it returns the error:

fmriprep: error: Path should point to a file (or symlink of file)

This is the command I’m using, is there something I’m missing?

time docker run -it --rm \
-v ~/.licenses/freesurfer/license.txt:/fslicense.txt:ro \
-v /e/zac/proj_restingstate/processed_data:/data:ro \
-v /e/zac/proj_restingstate/processed_data/output_fmriprep:/out \
poldracklab/fmriprep:latest /data/output_heudiconv/ /out participant --participant_label {001..002} -vv --fs-license-file /fslicense.txt --skip_bids_validation

I think both paths in a -v flag need to be absolute.

Hmm, I went on to try:

time docker run -it --rm \
-v **/home/zac/**.licenses/freesurfer/license.txt:/opt/freesurfer/license.txt:ro \
-v /e/zac/proj_restingstate/processed_data:/data:ro \
-v /e/zac/proj_restingstate/processed_data/output_fmriprep:/out \
poldracklab/fmriprep:latest /data/output_heudiconv/ /out participant --participant_label {001…002} -vv --fs-license-file /opt/freesurfer/license.txt --skip_bids_validation

but the same error (fmriprep: error: Path should point to a file (or symlink of file)) occurred.

I thought the file might not be mounted, so while the container was running, I went to check if the file was indeed there and it was! One thing that might be important though, was that when I tried to access the file it said that permission was denied. I’m not sure if it’s a docker thing to disallow the docker CLI to access any files while the container is running, though.
image

Another thing I tried - as I saw in one of the error messages was that fMRIprep will look for the license with the $FS_LICENSE environment variable - was to go into the container and create a new environment variable that pointed to the license file (while removing the --fs-license-file argument):

export FS_LICENSE=/opt/freesurfer/license.txt

This did not work as well and returned the error that a valid license is required for Freesurfer to run.

@zyeapp

what output do you get when running:
ls -l /home/zac/.licenses/freesurfer/license.txt

@mgxd

I get this output:

-rwxrwxrwx 1 zac zac 55 Jul  5 12:31 /home/zac/.licenses/freesurfer/license.txt

Edit:
This gave me the idea to check within the container when it’s running to see if the license file is acting weird (thank you!), and it is (ASegStatsLUT.txt is a file generated by fMRIprep in the /opt/freesurfer/ directory within the docker container):
image

After a bit of messing around, I found out the problem:

I was using WSL1 to run fmriprep and so the -v argument did not work if I referenced /home/zac/ as this was an invalid path (since windows runs on /d/ or /e/ instead and this /home directory is actually stored somewhere in the system32.

I moved the fslicense to somewhere else and referenced the windows path it worked perfectly.

Just a heads up for those of you using WSL!

Thank you everyone for your help! :slight_smile: