Nipype: Configuration or Matlab (MCR) or SPM not found

Hi there,

I am trying to run a nipype script using a stand alone version of SPM using the compiled version of Matlab (MCR). I get following Error:
RuntimeError: Nipype could not find a valid Matlab or SPM configuration.

But I can start just SPM by using following command:
/home/usr/software/spm12/run_spm12.sh /home/usr/software/mcr/v93

This means, that Nipype cannot find neither matlab nor SPM.
In my bash file I have the following written:

.
.
.

helper functions

addpath() {
if [ -e $1 ]; then
export PATH=$PATH:$1
fi
}

addlibpath() {
if [ -e $1 ]; then
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$1
fi
}

added by Anaconda3 installer

export PATH="/home/usr/anaconda3/bin:$PATH"

export SOFT=$HOME/software
#Matlab Runtime and SPM12
export MCR_DIR=$SOFT/mcr/v93
addpath $MCR_DIR/bin
export SPM_DIR=$SOFT/spm12
export SPMMCRCMD=’$SPM_DIR/run_spm12.sh $MCR_DIR script’
export FORCE_SPMMCR=1

In my Nipype script, I have the following:
from nipype.interfaces import spm
spm.SPMCommand.set_mlab_paths(matlab_cmd=os.environ[‘SPMMCRCMD’], use_mcr=True)

Can someone tell me why it is not working? I tried so many things now…

Thanks ahead :slight_smile: