Interface BET failed to run

When I try to run nipype I met some error like this. Is there anyone can help?

170918-21:09:59,986 interface WARNING:
FSLOUTPUTTYPE environment variable is not set. Setting FSLOUTPUTTYPE=NIFTI
Traceback (most recent call last):
File “/home/sunny/PycharmProjects/nipype/”, line 13, in
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/”, line 1081, in run
runtime = self._run_wrapper(runtime)
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/”, line 1724, in _run_wrapper
runtime = self._run_interface(runtime)
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/fsl/”, line 144, in _run_interface
runtime = super(BET, self)._run_interface(runtime)
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/”, line 1750, in _run_interface
(self.cmd.split()[0], runtime.hostname))
OSError: command ‘bet’ could not be found on host cynthia-PC
Interface BET failed to run.

I can successfully run fsl in the terminal and when I type BET in the terminal I can see the help messages.
Is there someone who can tell me how to deal with it?


Are you changing any environmental variables within your script?

If not, this looks like a problem with FSL and your PATH - there’s a little section in the nipype beginner’s guide that will ensure your FSL installation will be found.

Thank you for your reply,and I just followed every step on the page you mentioned.Besides I also successfully run FSL and Freesurfer respectively in the terminal.But failed with these codes down here.By the way, I did not installed SPM,MATLAB,ANTs and AFNI.Does that matters?

import nipype.interfaces.fsl as fsl
myb.inputs.in_file = ‘/home/sunny/nipype_tutorial/data/sub001/struct.nii.gz’
myb.inputs.out_file = ‘/home/sunny/nipype_tutorial/output/sub001/struct_bet.nii.gz’

@cynthia - after you changed the bashrc, did you source it to verify the changes?

source ~/.bashrc

Then retry running your script

Tank you for your reply,I’m sure that I’ve sourced it.And when I at type fsl in the terminal I can see the GUI,I also did fsl BET with the GUI successfully. But then I failed here.I am really confused.

@cynthia my apologies, the beginner guide is for FSL 5.0

can you try the following commands on your system:

echo $FSLDIR

Thank you for your reply very much! I get this with these commands:

sunny@cynthia-PC:~$ echo $FSLDIR
sunny@cynthia-PC:~$ ls $FSLDIR
bin data doc etc tcl

And when I type fsl in the terminal I can see FSL5.0.9 on the top of the GUI

I also added these lines in the ~/.bashrc as the page showed:

. ${FSLDIR}/5.0/etc/fslconf/

export FREESURFER_HOME=/usr/local/freesurfer

export PATH=/usr/lib/afni/bin:$PATH

@cynthia can you try the following in a terminal:

  1. Remove the changes you made to the .bashrc

  2. Add

. ${FSLDIR}/5.0.9/etc/fslconf/
  1. save the file and source ~/.bashrc

  2. python -c "from nipype.interfaces.fsl import Info; print(Info.version())"

Hopefully you should see your version number output.

But I checked the file path that under the folder ‘fsl’ there is only a folder named 5.0,there is no folder named5.0.9

Alright, you’ll have to add the bin folder within fsl/5.0 to your PATH.

Someone ran into a similar problem in the past, perhaps this exchange can help further.!topic/nipy-user/q5mcPSlsPnE

sorry,actually I’ve tried that but failed also.