Error running SPM realign node

Hi folks,

So I have this pipeline that has a SPM realign node. It runs OK in my laptop but when I’m running it on cluster server, it gives the following crash log,

Traceback (most recent call last):
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/pipeline/plugins/”, line 43, in run
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/pipeline/engine/”, line 407, in run
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/pipeline/engine/”, line 517, in _run_interface
self._result = self._run_command(execute)
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/pipeline/engine/”, line 650, in _run_command
result =
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/interfaces/”, line 1053, in run
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/interfaces/”, line 994, in _check_version_requirements
if names and self.version:
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/interfaces/spm/”, line 293, in version
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/interfaces/spm/”, line 188, in version
out = sd._strip_header(out.runtime.stdout)
File “/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype/utils/”, line 52, in _strip_header
index = doc.index(hdr)
ValueError: substring not found

I have added the SMP12 path in the Matlab startup.m and it tests OK. The only thing that I have not done according to the Nipype Beginner’s Guide manual, is to install Neuro Debian (since it requires sudo for installation). Thank you for your help.

Also this is my output to nipype.get_info(),
{‘commit_hash’: ‘%h’,
‘commit_source’: ‘archive substitution’,
‘networkx_version’: ‘2.0’,
‘nibabel_version’: ‘2.2.0’,
‘nipype_version’: ‘0.14.0-rc1’,
‘numpy_version’: ‘1.13.3’,
‘pkg_path’: ‘/auto/k1/arash/anaconda3/lib/python3.6/site-packages/nipype’,
‘scipy_version’: ‘1.0.0’,
‘sys_executable’: ‘/auto/k1/arash/anaconda3/bin/python’,
‘sys_platform’: ‘linux’,
‘sys_version’: ‘3.6.3 |Anaconda custom (64-bit)| (default, Oct 13 2017, 12:02:49) \n[GCC 7.2.0]’,
‘traits_version’: ‘4.6.0’}


looks like Nipype is having problems grabbing your SPM version. Could you try the following in the command line?

export SPM_PATH=/path/to/spm12
python -c "from nipype.interfaces import spm; import os; spm.SPMCommand.set_mlab_paths(paths=os.environ['SPM_PATH']); spm.SPMCommand().version"

Yes you are right. I have reproduced the error in Jupyter notebook. However I can not figure out how to fix it. I attached the screen shot here,

@arash-ash what version of matlab are you running?

can you try adding %pdb to the top of the [17] block you posted above and rerunning the block? This will enable debugging mode, and a pdb prompt should appear underneath. within the pdb prompt please type doc and paste the output.

It seems nipype is running into a different matlab header

The Matlab header file seems ok. what else could be the problem?!

I have exactly the same issue!
Did you find out what the problem was?

Many thanks in advance