Fmriprep no longer working in docker

Summary of what happened:

Hi everyone, I believe I am having an issue simlar to this post: fmriprep-docker command.

The problem: I am trying to run an fmriprep.sh script but get the following error.

I used this file last week to preprocess data successfully and am not sure what I have done different in the set up process prior to running the command.

Command used (and if a helper script was used, a link to the helper script or the command generated):

bids_root_dir=/Users/ams616/Desktop/sub-101/ses-01
participant=101

#number of processors to use (set to the computing environment used at URMC).
nthreads=10
mem=30 #gb

# number of degrees of freedom for co-registration (6 is default, 12 is max)
coregdof=12

# Convert virtual memory from gb to mb
mem=`echo "${mem//[!0-9]/}"` #remove gb at end
mem_mb=`echo $(((mem*1000)-1000))`

# Run fmriprep using docker
docker run -ti --rm \
    -v $bids_root_dir:/data:ro \
    -v $bids_root_dir/derivatives:/out \
    -v /Users/ams616/Desktop/SFA-MVPA-BIDS/license.txt:/opt/freesurfer/license.txt \
    poldracklab/fmriprep:latest /data /out \
    participant \
    --participant-label $participant \
    --skip-bids-validation \
    --md-only-boilerplate \
    --fs-no-reconall \
    --n-cpus 10 \
    --output-spaces MNI152NLin2009cAsym:res-native \
    --bold2t1w-dof $coregdof \
    --stop-on-first-crash \
    --mem_mb $mem_mb

Version:

poldracklab/fmriprep:latest

Environment :

I am running the code via my terminal on Mac to access the program via docker.

Mac specifications: Apple M3 max, 36gb memory.

Data formatted according to a validatable standard? Please provide the output of the validator:

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

ams616@HSIT-MCF9M6XQ52 sub-101 % ./fmriprep.sh
/usr/local/bin/fmriprep-docker: line 1: 404:: command not found

Screenshots / relevant information:

Given the other posts I ran the below, which is informative to me that I do indeed have fmriprep-docker, but am likely having a path issue.

/usr/local/bin/fmriprep-docker: line 1: 404:: command not found
ams616@HSIT-MCF9M6XQ52 sub-101 % find ~/.local -name fmriprep-docker

I believe my solution is to figuring out how to fix/update the path, but I am unclear on how to do that. I have asked my favorite chatbots and they are unable to help either!


Hi @AlexSwiderski,

Lots of things here:

That’s not the right distribution. Use nipreps/fmriprep instead.

This is not recomended.

You do not use fmriprep-docker in your code so I cannot see why you would be getting this error. Are you sure the code you provided is accurate?

Did you install fmriprep-docker in a virtual environment (e.g., conda)?

Best,
Steven

Thanks so much, Steven. I really appreciate your comments!!!

Regarding the fs-no-reconall, i am using stroke data and it was advised to me to not run this. If i can actually use it, that would be pretty great!

I reran the install and checked the version to still get the same 404 error, see below:

 ams616@HSIT-MCF9M6XQ52 sub-101 % docker pull nipreps/fmriprep:23.2.3
23.2.3: Pulling from nipreps/fmriprep
Digest: sha256:f46909a9c7556befbeded9ef406d75195ceef9f38f7fec875bcfe395a8a6ee28
Status: Downloaded newer image for nipreps/fmriprep:23.2.3
docker.io/nipreps/fmriprep:23.2.3

What's Next?
  View a summary of image vulnerabilities and recommendations → docker scout quickview nipreps/fmriprep:23.2.3
ams616@HSIT-MCF9M6XQ52 sub-101 % fmriprep-docker --v                
/usr/local/bin/fmriprep-docker: line 1: 404:: command not found

I did realize i had a descrepency in my code, that you pointed out as well. I reran the script as follows and i still got the 404 error.

bids_root_dir=/Users/ams616/Desktop/sub-101/ses-01
participant=101

#number of processors to use (set to the computing environment used at URMC).
nthreads=8
mem=16 #gb"

# number of degrees of freedom for co-registration (6 is default, 12 is max)
coregdof=12

#Convert virtual memory from gb to mb
mem=`echo "${mem//[!0-9]/}"` #remove gb at end
mem_mb=`echo $(((mem*1000)-1000))`

# I skip BIDS validation because I do it manually before running fmriprep.
# I have to put 'sudo -E' before running the command because we use a linux virtual machine.
# You may need to remove 'sudo -E' based on your operating system/computing environment.

fmriprep-docker $bids_root_dir $bids_root_dir/derivatives \
    participant \
    --participant-label $participant \
    --skip-bids-validation \
    --md-only-boilerplate \
    --fs-license-file /Users/ams616/Desktop/SFA-MVPA-BIDS/license.txt \
    --fs-no-reconall \
    --n-cpus 8 \
    --output-spaces MNI152NLin2009cAsym:res-native \
    --bold2t1w-dof $coregdof \
    --nthreads $nthreads \
    --stop-on-first-crash \
    --mem_mb $mem_mb

Did you install this? fmriprep-docker · PyPI

Trying to make this thread maximally helpful, the tl;dr: my computer was having write issues because it has shared admin issues with the University. Will I probably look for this post later? maybe :smiley:

First, i knew that I had python and pip on my computer, i just didnt know how to use terminal to find this out:

python3 --version
pip3 --version

What i didnt expect, was that pip wasnt talking to my terminal right.

zsh: command not found: pip

So i… deleted and reinstalled and reinstalled both pip and fmri prep.

Here is my brightest light bulb moment I found that fmriprep-docker was already installed but the command was not functioning correctly.

  1. I had initially installed the WRONG version of fmri prep; however, i was having permission issues removing it. This required using ‘sudo’ prior to my command to remove which asks you to type the password to your computer after you run the commnand.
sudo rm /usr/local/bin/fmriprep-docker

PATH ISSUES:
So i got all that done, which is great! Then I had to return to my problem of a bath issue. I learned that fmriprep-docker script was installed, but NOT IN MY PATH…

To address this you need to add the path. Here is how, in command line:

nano ~/.zshrc

Then, add the path of your fmriprep in a similar fashion as here*:
*this was confusing for me, after you add the correct path as outlined blelow you will need to save the path via the options in the window.

#note1 mac path
#note2 change XXX to your user
#note3 make sure remaining path is the location of your fmriprep

export PATH=$PATH:/Users/XXX/Library/Python/3.9/bin

Thanks again for all your help tonight. I tried to be maximally helpful with the solution below!

A side note, re: --fs-no-reconall \

To your knowledge, can you use reconall with data that has a lesion?

No problem, glad you were able to investigate and find the problem! I’ve seen mixed results, I would try out a few subjects and report back!