Nipype SPM12 / Matlab Compiler Runtime interface functions

121 Views Asked by At

I'm trying to run SPM functions via Nipype but i get the same error when calling different SPM functions.

I can successfully connect to the Matlab compiler runtime and execute commands via nipype like so:

import nipype.interfaces.matlab as matlab
mlab = matlab.MatlabCommand()
mlab.inputs.script = 'spm ver'
mlab.run()

I can also import spm from nipype interfaces:

from nipype.interfaces import spm
matlab_cmd = "opt/MATLAB Runtime/v99/toolbox/spm12_r7771/spm12/run_spm12.sh opt/MATLAB/MATLAB Runtime/v99 script"
spm.SPMCommand.set_mlab_paths(matlab_cmd=matlab_cmd, use_mcr=True)

However, when i run the following (or other spm functions), e.g.

spm.SPMCommand().version

I end up with the same error, see:


ValueError                                Traceback (most recent call last)
 File C:\Anaconda\envs\ConcSpace\lib\site-packages\nipype\utils\spm_docs.py:49, in 
_strip_header(doc)
 48 try:
---> 49     index = doc.index(hdr)
 50 except ValueError as e:

ValueError: substring not found

The above exception was the direct cause of the following exception:

full error log

I'm not sure its because of missmatching versions of MCR or wrong paths i set? I have Matlab2020b as well as the MCR installed separately on a win10 machine. Nipype is up to date and running on a conda env in jupyterlab.

Glad for any tips that could fix it. Thanks.

0

There are 0 best solutions below