Workaround for FSL 6.0.4 python dependencies

imglob or imcp provided with FSL requires numpy.testing.decorators. However, numpy.testing.decorators has been deprecated from numpy 1.18. So, if you use numpy >=1.18, you see the following error:

ModuleNotFoundError: No module named 'numpy.testing.decorators'

Paul Mccarthy kindly suggested a workaround for this problem.

The below is his original message.;a26a0779.2010

1. Move $FSLDIR/fslpython/envs/fslpython/bin/python3.7 to $FSLDIR/fslpython/envs/fslpython/bin/python3.7_bin
2. Replace $FSLDIR/fslpython/envs/fslpython/bin/python3.7 with a script containing this:

#!/usr/bin/env bash
thisdir=$(cd $(dirname $0) && pwd)
$thisdir/python3.7_bin -I "$@"

3. Change the permissions of the new $FSLDIR/fslpython/envs/fslpython/bin/python3.7 to make it executable

With this suggestion, I wrote a tiny script.


cd $FSLDIR/fslpython/envs/fslpython/bin/
sudo mv python3.7 python3.7_bin

cat << 'EOF' | sudo tee python3.7 > /dev/null
#!/usr/bin/env bash
thisdir=$(cd $(dirname $0) && pwd)
$thisdir/python3.7_bin -I "$@"

sudo chmod 755 python3.7

This script will make FSL use internal python within FSL.