QSIprep not finding FS license

Hi all,

I recently installed QSIprep. I ran sMRIPrep and fMRIPrep on a subject and now want to run DWI preprocessing on their data. I have a FreeSurfer license; I used it to run fMRIPrep.

Here is what I tried to run:

docker run -i --rm
-v /Users/salinasf/Desktop/PTSD-database/bids:/data:ro
-v /Users/salinasf/Desktop/PTSD-database/bids/derivatives:/out
pennbbl/qsiprep:latest /data /out participant --participant_label 0007 --output_resolution 2 --work_dir /Users/salinasf/Desktop/PTSD-database/bids --skip_bids_validation --fs-license-file /Users/salinasf/Desktop/PTSD-database/bids/derivatives/license.txt --freesurfer-input /Users/salinasf/Desktop/PTSD-database/bids/derivatives/sourcedata/freesurfer/sub-0007

This is the error:

Traceback (most recent call last):
File “/usr/local/miniconda/bin/qsiprep”, line 8, in
sys.exit(main())
File “/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/cli/run.py”, line 595, in main
set_freesurfer_license(opts)
File “/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/cli/run.py”, line 552, in set_freesurfer_license
raise RuntimeError("""
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 FreeSurfer Registration form
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

I used the same license file for my fMRIPrep run. Thanks for your help!

Hi @salinasf . I think the way in which you’re directing QSIPrep to the license is a bit off.

Do you want to try the following? Notice that the paths are different for everything after the name of the image, pennbbl/qsiprep:latest

docker run -i --rm
-v /Users/salinasf/Desktop/PTSD-database/bids:/data:ro \
-v /Users/salinasf/Desktop/PTSD-database/bids/derivatives:/out \
pennbbl/qsiprep:latest /data /out participant \
--participant_label 0007 --output_resolution 2 \
--work_dir /out --skip_bids_validation \
--fs-license-file /out/license.txt \
--freesurfer-input /out/sourcedata/freesurfer/sub-0007

If that makes the error about an invalid license go away, the following is a bit of an explanation.

When you write a line like

  -v /Users/salinasf/Desktop/PTSD-database/bids/derivatives:/out 

you are “mounting” a path into the docker container. For docker run commands, everything after the name of the image will refer to the folder structure inside the container, which will generally be different than your own folder structure. That -v lines says something like “take the folder from your machine located at /Users/salinasf/Desktop/PTSD-database/bids/derivatives and put it in the container at a location called /out”. That’s why the updated command had --fs-license-file /out/license.txt

Out of curiosity, would you be able to share how you ran fMRIPrep?

Great! That works! Thank you @psadil for finding my error and (more importantly) explaining why my command was off.

It turns out that my fMRIPrep command actually had the following line in the docker call:

-v ${mainpath}/derivatives/license.txt:/opt/freesurfer/license.txt:ro

Thanks again!!

1 Like