Nipype can't find FSL executable file

Hello, I’m using FSL with nipype and it is unable to find the executable file ‘feat_model’ from fsl, even though it’s definitely in my fsl installation - any suggestions? I must be missing a simple command to help nipype find it…


import pandas as pd
import glob
from nipype.interfaces.base import Bunch
import nipype.interfaces.fsl as fsl  
import nipype.pipeline.engine as pe 
import nipype.algorithms.modelgen as model  
import os  

data_path = '/path/to/my/processed/data/'; 


#Set up model fitting workflow
modelfit = pe.Workflow(name='modelfit')

# Use nipype.algorithms.modelgen.SpecifyModel to generate design information
modelspec = pe.Node(interface=model.SpecifyModel(), name="modelspec",output_names="session_info")
modelspec.inputs.input_units = 'secs'
modelspec.inputs.functional_runs = ['/Users/mycomputer/anaconda3/pkgs/nibabel-3.0.0-py_0/site-packages/nibabel/tests/data/functional.nii']
modelspec.inputs.high_pass_filter_cutoff = 0
modelspec.inputs.time_repetition = 0
modelspec.inputs.subject_info = my_subject_info

#Use nipype.interfaces.fsl.Level1Design to generate a run specific fsf file for analysis
level1design = pe.Node(interface=fsl.Level1Design(),
level1design.inputs.interscan_interval = 0 
level1design.inputs.bases = {'dgamma':{'derivs': True}} 

# Use nipype.interfaces.fsl.FEATModel to generate a run specific mat file for use by FILMGLS
modelgen = pe.MapNode(
    iterfield=['fsf_file', 'ev_files'])

# Use nipype.interfaces.fsl.FILMGLS to estimate a model specified by a mat file and a functional run
modelestimate = pe.MapNode(
    interface=fsl.FILMGLS(smooth_autocorr=True, mask_size=5, threshold=1000),
    iterfield=['design_file', 'in_file'])

    (modelspec, level1design, [('session_info', 'session_info')]),
    (level1design, modelgen, [('fsf_files', 'fsf_file'), ('ev_files','ev_files')]),
    (modelgen, modelestimate, [('design_file', 'design_file')])

    mdl =
except(RuntimeError) as err:
    print("RuntimeError:", err)

From the same shell you’re running your code, can you run feat_model?

Hi thank for your response! I can run feat_model from the command line, but when I try to access it via nipype by using the fsl.FEATModel() command in a node it can’t find the executable file.

How are you running nipype?

I’m running the python script in Spyder and importing the nipype packages as above

It is likely that your PATH inside Spyder doesn’t match your PATH in your shell.

I can’t seem to align them - I’ve tried adding all the fsl and nipype folders to the path in spyder, changing my working directory to where the fsl files are stored, etc. Any suggestions how I might make the feat_model command usable in nipype?

Try running it from the shell, not Spyder? I don’t know what’s required to make Spyder work. You could also try running Spyder from the shell, to ensure the environment variables propagate.

Thanks for your help @effigies - as an update, it was indeed an issue with my spyder path. To fix this I open spyder by navigating in terminal to the file where my fsl files are stored (for me, /usr/local/fsl) and open the IDE from there.