In singularity no all paths from the host system are accessible inside the container. Which ones are depends on the configuration of singularity (performed by the administrator). Depending on the configuration you might be able to make some folder accessible as a user via command line arguments (more info here: http://singularity.lbl.gov/docs-mount).
However the quickest solution would be to put the license file inside a folder that you know is already accessible such as $HOME or /exports/fsw/mrgiffin/UG/BIDS.
Great, thanks. Copying the license file to $HOME worked (it finds the license now, I’m getting another error but at least that problem is solved), turns out it was a problem of path accessibility. Thanks again.
I’m getting a similar error, and I’ve downloaded (and re-loaded) a freesurfer license (but that didn’t solve the issue). Here’s the command I’m running.
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/multiproc.py”, line 62, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 441, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 518, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 594, in _run_command
result = self._interface.run()
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/freesurfer/base.py”, line 268, in run
return super(FSCommandOpenMP, self).run(**inputs)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/freesurfer/base.py”, line 144, in run
return super(FSCommand, self).run(**inputs)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py”, line 485, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py”, line 973, in _run_interface
self.raise_exception(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/core.py”, line 912, in raise_exception
**runtime.dictcopy()))
RuntimeError: Command:
mri_robust_template --satit --fixtp --mov /data/sub-NDARAY461TZZ/anat/sub-NDARAY461TZZ_acq-VNav_T1w.nii.gz /data/sub-NDARAY461TZZ/anat/sub-NDARAY461TZZ_acq-VNavNorm_T1w.nii.gz --inittp 1 --iscale --noit --template sub-NDARAY461TZZ_acq-VNav_T1w_template.nii.gz --subsample 200 --lta /home/jamielh/Volumes/Hanson/NKI_HealthyBrainNetwork/CBIC/R3/derivatives/working/fmriprep_wf/single_subject_NDARAY461TZZ_wf/anat_preproc_wf/anat_template_wf/t1_merge/tp1.lta /home/jamielh/Volumes/Hanson/NKI_HealthyBrainNetwork/CBIC/R3/derivatives/working/fmriprep_wf/single_subject_NDARAY461TZZ_wf/anat_preproc_wf/anat_template_wf/t1_merge/tp2.lta
Standard output:
$Id: mri_robust_template.cpp,v 1.54 2016/05/05 21:17:08 mreuter Exp $
–satit: Will estimate SAT iteratively!
–fixtp: Will map everything to init TP!
–mov: Using /data/sub-NDARAY461TZZ/anat/sub-NDARAY461TZZ_acq-VNav_T1w.nii.gz as movable/source volume.
–mov: Using /data/sub-NDARAY461TZZ/anat/sub-NDARAY461TZZ_acq-VNavNorm_T1w.nii.gz as movable/source volume.
Total: 2 input volumes
–inittp: Using TP 1 as target for initialization
–iscale: Enableing intensity scaling!
–noit: Will output only first template (no iterations)!
–template: Using sub-NDARAY461TZZ_acq-VNav_T1w_template.nii.gz as template output volume.
–subsample: Will subsample if size is larger than 200 on all axes!
–lta: Will output LTA transforms
Setting iscale …
reading source ‘/data/sub-NDARAY461TZZ/anat/sub-NDARAY461TZZ_acq-VNav_T1w.nii.gz’…
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
Standard error:
Return code: 255
180507-14:17:56,677 workflow INFO:
[Node] Finished “fmriprep_wf.single_subject_NDARAY461TZZ_wf.func_preproc_task_rest_run_2_wf.bold_hmc_wf.mcflirt”.
180507-14:17:59,178 workflow INFO:
[Node] Setting-up “fmriprep_wf.single_subject_NDARAY461TZZ_wf.func_preproc_task_rest_run_1_wf.bold_hmc_wf.fsl2itk” in “/home/jamielh/Volumes/Hanson/NKI_HealthyBrainNetwork/CBIC/R3/derivatives/working/fmriprep_wf/single_subject_NDARAY461TZZ_wf/func_preproc_task_rest_run_1_wf/bold_hmc_wf/fsl2itk”.
180507-14:17:59,363 workflow INFO:
[Node] Running “fsl2itk” (“fmriprep.interfaces.itk.MCFLIRT2ITK”)
180507-14:18:51,155 workflow INFO:
[Node] Finished “fmriprep_wf.single_subject_NDARAY461TZZ_wf.func_preproc_task_rest_run_1_wf.bold_hmc_wf.fsl2itk”.
180507-14:18:53,386 workflow INFO:
[Node] Setting-up “fmriprep_wf.single_subject_NDARAY461TZZ_wf.func_preproc_task_rest_run_1_wf.bold_bold_trans_wf.bold_transform” in “/home/jamielh/Volumes/Hanson/NKI_HealthyBrainNetwork/CBIC/R3/derivatives/working/fmriprep_wf/single_subject_NDARAY461TZZ_wf/func_preproc_task_rest_run_1_wf/bold_bold_trans_wf/bold_transform”.
180507-14:18:53,544 workflow INFO:
[Node] Running “bold_transform” (“fmriprep.interfaces.itk.MultiApplyTransforms”)
Perfect, that solved it. Interestingly, I think that initial syntax (without license.txt) worked in some iterations of things. (but I added the full path and all’s well).
I just wanted to add my own experience with the license issue. Using this method mentioned in the installation instructions circumvented the license issue but resulted in fmriprep not finding my participants or scans:
Not sure if this should be addressed in the documentation or it resulted from some error on my part. The moment I set the FS_License environment variable rather than enabling it when using fmriprep-docker, fmriprep was once again able to find my participants and scans.
…
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.
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."
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:
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
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:
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:
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)