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/test_build_pipeline.py”, line 13, in
mybet.run()
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/base.py”, line 1081, in run
runtime = self._run_wrapper(runtime)
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/base.py”, line 1724, in _run_wrapper
runtime = self._run_interface(runtime)
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/fsl/preprocess.py”, line 144, in _run_interface
runtime = super(BET, self)._run_interface(runtime)
File “/home/sunny/anaconda3/lib/python3.6/site-packages/nipype/interfaces/base.py”, 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?

@cynthia

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=fsl.FAST()
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’
myb.run()

@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
ls $FSLDIR

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


sunny@cynthia-PC:~$ echo $FSLDIR
/usr/share/fsl/5.0
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:


#FSL
FSLDIR=/usr/share/fsl
. ${FSLDIR}/5.0/etc/fslconf/fsl.sh
PATH=${FSLDIR}/5.0/bin:${PATH}
export FSLDIR PATH

#FreeSurfer
export FREESURFER_HOME=/usr/local/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh

#AFNI
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=/usr/share/fsl
. ${FSLDIR}/5.0.9/etc/fslconf/fsl.sh
PATH=${FSLDIR}/5.0.9/bin:${PATH}
export FSLDIR PATH
  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. https://groups.google.com/forum/#!topic/nipy-user/q5mcPSlsPnE

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