Load fsl module when running Nipype on a cluster

Hi there,

Sorry in advance if it’s too simple. I am trying to use fsl with nipype. I have built a very simple workflow in jypyter notebook. The workflow basically applies the brain masks on the epi data for skullstripping, as well as smoothing the epi file. When I ran the workflow (with “preproc.run(‘MultiProc’, plugin_args={‘n_procs’: 1})”), it gave me the error that “No command “fslmaths” found on host n#. Please check that the corresponding package is installed.”

In our cluster, if I want to use any fsl command, I need to run “module load fsl” in the command line to load the module. Therefore, I am wondering if there is any way I can load the module when running the workflow through Jypyter Notebook?

Thanks very much for your help!


To me, this questions sounds like you should rather ask it to the staff of the cluster computer.

Definitely not too simple, we also have centOS installed on our hpc, so we have the module load feature as well.

I toyed around a little, but couldn’t find an easy solution with using the magic %env.

But what you can do is type module load FSL before you open the jupyter notebook and it should work.

If you always want the fsl commands when you login to your cluster you can add module load fsl to your ~/.bash_profile (try first) or your ~/.bashrc (if it doesn’t exist you can make one: touch ~/.bashrc)

some reading on .bashrc and .bash_profile

Then you should never have to type module load fsl before opening/executing your jupyter notebook


Hi James,

Thanks for the reply! I added the module load FSL into my bash file for submitting the jupyter notebook and it is working now!

Thanks for your help!

1 Like