fMRIPrep-docker command

I used -v docker pull nipreps/fmriprep: \ and it worked but when I run this code:

I get this error:

Do I need to change something about this code and if so, would you know what that should be?

I really do appreciate your time in helping me out :slight_smile:

-v is used to mount a volume to Docker. So if you want Docker to be able to use a drive, you mount it with -v, similar to -B in Singularity if you have used that before. -v is not used to specify command arguments. So you should bind all the drives you need to docker, then specify the fmriprep arguments as normal. Have you read this documentation?

Right, it worked to mount a volume in Docker.

However, now I’m struggling with this code:

I get this error:

Any suggestions?

Try to put the --fslicense-file argument before participant.
Also, shouldn’t your paths start with a “/” : /home/rubina/derivatives for example?

1 Like

When I try what you suggested (putting license file before participant), I get this error:

ok sorry for the misleading suggestion.
I found this ressource:

If you follow their exemple, you could try (but this is exactly what was suggesting @effigies earlier, you may have tried it already):
fmriprep-docker /home/rubina/BIDS /home/rubina/derivatives participant --participant-label C0120061 --fs-license-file /home/rubina/derivatives/freesurfer/license.txt --low-mem

Just eyeballing it, it looks like the arguments are starting with some unicode dash instead of an ASCII dash.

Yes, because when I use the normal - it doesn’t work.

Yes, I tried that code (without /derivatives/freesurfer) but I get the same error:

(with and even without sub)

Python isn’t going to recognize unicode dashes.

I’m using Ubuntu, not Python.

Apologies for being unclear. fMRIPrep is written in Python. If you pass it arguments that it cannot understand, it will not work.

I’m seeing some things confused here, so at the risk of over-explaining, let me lay out the design:

  1. fMRIPrep is a Python program, run with the form fmriprep <INPUT> <OUTPUT> participant <FLAGS>.
  2. We recommend using a Docker container to ensure all dependencies are present. For this, the form becomes docker run --rm -it <MOUNTS> nipreps/fmriprep:<version> <INPUT> <OUTPUT> participant <FLAGS>. The mounts are of the form -v <OUTSIDE>:<INSIDE> and may require changes to the location of INPUT/OUTPUT and some FLAGS.
  3. Because this can be tough to get going on, fmriprep-docker provides an interface that will convert from fmriprep-docker <INPUT> <OUTPUT> participant <FLAGS> to an adjusted docker run --rm -it <MOUNTS> nipreps/fmriprep:<version> <INPUT> <OUTPUT> participant <FLAGS> that allows you to act as if you’re running fMRIPrep directly. So you SHOULD NOT manually add -v flags. fmriprep-docker will attempt to pass them to fmriprep, not Docker.

@effigies, thank you so much for such a thorough explanation as to how fMRIPrep works :slight_smile:

However, I removed -v flags (in my earlier posts) and put the code in one line but cannot figure out what I’m missing in my code atm.

Can you copy-paste the full command and outputs? Screenshots are very difficult to work with.

My apologies. Thank you for your help.

Here is my code:

fmriprep-docker /home/rubina/BIDS/ /home/rubina/derivatives participant – –participant–label sub–C0120061 – –fs–license–file /home/rubina/fs-license/license.txt – –low–mem

The output is as follows:

Warning: <8GB of RAM is available within your Docker environment.
Some parts of fMRIPrep may fail to complete.
Continue anyway? [y/N]y
RUNNING: docker run --rm -e DOCKER_VERSION_8395080871=20.10.7 -it -v /home/rubina/BIDS/sub-C0120061:/data:ro -v /home/rubina/derivatives:/out nipreps/fmriprep:20.2.2 /data /out participant ––participant–label sub-C0120061 ––fs–license–file /home/rubina/fs-license/license.txt ––low–mem
usage: fmriprep [-h] [–version] [–skip_bids_validation]
[-t TASK_ID] [–echo-idx ECHO_IDX] [–bids-filter-file FILE]
[–anat-derivatives PATH] [–bids-database-dir PATH]
[–nprocs NPROCS] [–omp-nthreads OMP_NTHREADS]
[–mem MEMORY_MB] [–low-mem] [–use-plugin FILE]
[–anat-only] [–boilerplate_only] [–md-only-boilerplate]
[–error-on-aroma-warnings] [-v]
[–ignore {fieldmaps,slicetiming,sbref,t2w,flair} [{fieldmaps,slicetiming,sbref,t2w,flair} …]]
[–output-spaces [OUTPUT_SPACES [OUTPUT_SPACES …]]]
[–bold2t1w-init {register,header}] [–bold2t1w-dof {6,9,12}]
[–force-bbr] [–force-no-bbr] [–medial-surface-nan]
[–dummy-scans DUMMY_SCANS] [–random-seed _RANDOM_SEED]
[–aroma-melodic-dimensionality AROMA_MELODIC_DIM]
[–fd-spike-threshold REGRESSORS_FD_TH]
[–dvars-spike-threshold REGRESSORS_DVARS_TH]
[–skull-strip-template SKULL_STRIP_TEMPLATE]
[–skull-strip-t1w {auto,skip,force}] [–fmap-bspline]
[–fmap-no-demean] [–use-syn-sdc] [–force-syn]
[–fs-license-file FILE] [–fs-subjects-dir PATH]
[–no-submm-recon] [–cifti-output [{91k,170k}] |
–fs-no-reconall] [–output-layout {bids,legacy}]
[-w WORK_DIR] [–clean-workdir] [–resource-monitor]
[–reports-only] [–config-file FILE] [–write-graph]
[–stop-on-first-crash] [–notrack]
[–debug {compcor,all} [{compcor,all} …]] [–sloppy]
bids_dir output_dir {participant}
fmriprep: error: unrecognized arguments: – –participant–label sub-C0120061 – –fs–license–file /home/rubina/fs-license/license.txt – –low–mem
fMRIPrep: Please report errors to Issues · nipreps/fmriprep · GitHub

Here the dashes and spaces are definitely going to cause problems. Can you try copy-pasting the following?

fmriprep-docker /home/rubina/BIDS/ /home/rubina/derivatives participant --participant-label C0120061 --fs-license-file /home/rubina/fs-license/license.txt --low-mem

As suggested, I tried the code:

fmriprep-docker /home/rubina/BIDS/ /home/rubina/derivatives participant --participant-label C0120061 --fs-license-file /home/rubina/fs-license/license.txt --low-mem

I get this error message:

usage: fmriprep-docker [-h] [–version] [-i IMG] [-w WORK_DIR] [–output-spaces [OUTPUT_SPACES [OUTPUT_SPACES …]]]
[–fs-license-file PATH] [–fs-subjects-dir PATH] [–config-file PATH]
[–anat-derivatives PATH] [–use-plugin PATH] [–bids-database-dir PATH]
[–patch PACKAGE=PATH [PACKAGE=PATH …]] [–shell] [–config PATH] [-e ENV_VAR value]
[-u USER] [–network NETWORK] [–no-tty]
[bids_dir] [output_dir] [{participant}]
fmriprep-docker: error: Path should point to a file (or symlink of file): </home/rubina/fs-license/license.txt>.

Does this file exist, if you type ls /home/rubina/fs-license/license.txt?

It does exists but when I type that command it says:

rubina@DESKTOP-QRBPHG4:~$ ls /home/rubina/fs-license/license.txt
ls: cannot access ‘/home/rubina/fs-license/license.txt’: No such file or directory

It seems it does not exist there, at any rate. What’s its location in Windows?