fMRIPrep: migrating from docker execution to fmriprep-docker

Thanks for chiming in, Chris.

I just realized that I used the dock-pull to get the fmriprep docker image, it explains why I can’t use fmriprep-docker :joy:.

To run the fmriprep-docker wrapper, do I need to first delete the current fmriprep docker image? i.e., should I remove my current version of fmriprep and then use pip install --user --upgrade fmriprep-docker, or I can directly install without deleting the current docker image? (Assuming that the free space on my current drive is not that much).

Once installed, the fmriprep-docker wrapper has access to the different versions of the docker image (the ones you get with docker pull).

using fmriprep-docker <...> -i poldracklab/fmriprep:1.3.0.post2 you are indicating that you want to run fmriprep-1.3.0.post2, regardless the version of fmriprep-docker.

There is a subtlety here about the version: instead of using latest (which is the default when you don’t tell docker which version to be used), please always point to an existing version.

That is the best way of making sure you don’t introduce fmriprep version inconsistencies if you do not run all your subjects at once.

2 Likes

Hi, Oscar,

Thanks for pointing this out.
I tried to install fmriprep wrapper by pip install --user fmriprep, still I cannot run the code:

I use Ubuntu 18.04, Python 3.6.5 :: Anaconda, Inc. (PS: my own background, I am from a psychology background, a beginner on python, docker.)

I guess I have this problem because I messed up the different version of python or something, because I can’t even use pip list --user:

But, when using pip list --u, fmriprep was on the list.

I tried to search for solutions, but only found this github issue page which I can’t fully follow: https://github.com/pypa/pip/issues/6194.

Have you tried pip install --user fmriprep-docker?

Yes, it seems you have a bit messed up environment.

1 Like

These things are annoying, sorry. It usually happens when you have a couple competing environments. I would recommend running the following several times until it says it can’t do anything:

pip uninstall fmriprep-docker

Then:

pip install --user fmriprep-docker

If that doesn’t work, you could try installing it without --user (uninstalling again, first). Assuming you have permissions to do it, it’s more likely to work.

1 Like

Thanks you both!
I still have an environmental error.

This might be a deeper problem. You can try pip install --user --upgrade pip, but I have a suspicion that it’s just broken. There may be a better solution, but at that point, I would personally just delete my ~/.local directory and start from scratch.

What is the output of:

echo $PATH

and

env | grep PYTHONPATH

?

Hi, Both,

Really appreciate your quick reply.

Oscar, below is the output (no output for env | grep PYHONPATH)

Chris, you are right,

Is there some links for delete .local and start again?

(I’ve no idea how I broke it :sweat: )

I really just meant rm -r $HOME/.local. But note that that’s pretty drastic, and will remove a lot of things you have installed. If you’re content to reinstall things as you need them, then it should be fine. But you might be able to try something a little more confined like:

rm -r $HOME/.local/lib/python3.6/site-packages/pip*

I’ll note these are potentially dangerous things to do, so it might be worth googling around to see if there are better ways to fix things.

Hi, Chris,
I deleted the whole $HOME/.local folder. Then I can install fmriprep-docker, but still can’t run fmriprep-docker

here are my docker images
hcp4715@hcp4715-Precision-5510:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nipy/heudiconv latest ee62aa995a80 3 weeks ago 1.27GB
poldracklab/fmriprep latest d4b288343142 4 weeks ago 11.6GB
hello-world latest fce289e99eb9 8 weeks ago 1.84kB

Your root user will have a different PATH than your own user, so fmriprep-docker will not show up to the root user. You can try:

sudo `which fmriprep-docker` ...

But that may not have the right PYTHONPATH environment to work with. The better solution is to give your user permission to run Docker images. See @oesteban’s comment here:

1 Like

Hi, Chris,

Thanks. tried your first solution, seems that it can find the fmriprep-docker install by pip install --user

Maybe because I mounted Filesystem Root and /Home at different partitions of the disk?

No, it’s just a different environment. You can probably resolve it by installing fmriprep-docker to your system-wide Python installation:

# Uninstall from user
pip uninstall fmriprep-docker
# Install using the default Python interpreter found by sudo
sudo python -m pip install fmriprep-docker

Thanks so much, Chris.

I will try to figure out the environment (s) first, seems a bit complicated. I only knew that conda can be used to set different environment, didn’t expect docker also related to env.

Mar 10th, 2019 update:
Finally, I could run fmriprep-docker.

I figured out that I set the python 3.6 from anaconda as my default, instead of directly installed by command from terminal. That caused the permission problem of pip upgrade problem. I solved it by modifying the permission of anaconda.

Also, I followed the suggestion to run docker without sudo, but I failed after following the instructions on this page https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user. Then I searched the solution and additionally ran sg docker -c "bash" to run docker without sudo.