You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't get Matlab/SPM to work properly. Matlab's run script throws a runtime when calling spm.Info.name().
Actual behavior
Calling spm.Info.name() throws an error. mlab.run().runtime.stderr (in nipype.interfaces/spm/base.py) returns:
/opt/matlab/R2021b/bin/matlab: eval: line 1701: unexpected EOF while looking for matching `''
/opt/matlab/R2021b/bin/matlab: eval: line 1702: syntax error: unexpected end of file
with runtime.errorcode = 2
runtime.output is:
Starting matlab/R2021b
Executing /opt/matlab/R2021b/bin/matlab -singleCompThread -nodesktop -nosplash -singleCompThread -r fprintf(1,'Executing code at %s:\n',datestr(now));ver,try,addpath('/home/common/matlab/spm12_r7487_20181114');,if isempty(which('spm')),,throw(MException('SPMCheck:NotFound','SPM not in matlab path'));,end;,spm_path = spm('dir');,[name, version] = spm('ver');,fprintf(1, 'NIPYPE path:%s|name:%s|release:%s', spm_path, name, version);,exit;, ,catch ME,fprintf(2,'MATLAB code threw an exception:\n');fprintf(2,'%s\n',ME.message);if length(ME.stack) ~= 0, fprintf(2,'File:%s\nName:%s\nLine:%d\n',ME.stack.file,ME.stack.name,ME.stack.line);, end;end;;exit
MATLAB is selecting SOFTWARE OPENGL rendering.
Pype does not capture this error, and execution follows until:
out = sd._strip_header(out.runtime.stdout)
out_dict = {}
for part in out.split("|"):
key, val = part.split(":")
out_dict[key] = val
(in nipype.interfaces/spm/base.py) which raises an exception because runtime.output cannot be split by ":" into 2 parts.
also executes spm.Info.name(), but here execution follows without an error.
runtime.output:
MATLAB is selecting SOFTWARE OPENGL rendering.
< M A T L A B (R) >
Copyright 1984-2021 The MathWorks, Inc.
R2021b (9.11.0.1769968) 64-bit (glnxa64)
September 17, 2021
[...]
MATLAB Version: 9.11.0.1769968 (R2021b)
MATLAB License Number: 38957
Operating System: Linux 4.19.94-300.el7.x86_64 #1 SMP Thu Jan 9 16:15:13 UTC 2020 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Version 9.11 (R2021b)
[...]
Statistical Parametric Mapping Version 7771 (SPM12)
[...]
NIPYPE path:/home/common/matlab/spm12_r7487_20181114|name:SPM12|release:7771
The last line of the output is then properly processed in spm.Info.name() .
I replicated the same behavior in Python3.8, and Matlab 2018b and 2016b. I also tried using nipype installed via pip instead of conda.
How to replicate the behavior
This is probably a system-specific error (although nipype should capture Matlab's error code), but I'm out of ideas on what might be causing the problem.
I checked that in both calls to mlab.run() (i.e., initiated by spm.SPMCommand.set_mlab_paths and by spm.Info.name()) all fields in mlab.inputs are identical.
It seems that nipype knows the correct paths to Matlab and SPM in both calls.
Script/Workflow details
import nipype.interfaces.spm as spm
spm.SPMCommand.set_mlab_paths(paths='/home/common/matlab/spm12_r7487_20181114/',
matlab_cmd='/opt/matlab/R2021b/bin/matlab') #works OK
print(spm.Info.name(paths='/home/common/matlab/spm12_r7487_20181114/')) # raises the error
My python environment inside container [Base Tag: ???]
My python environment outside container
The text was updated successfully, but these errors were encountered:
themeo
changed the title
Matlab (called by interfaces.spm) throws an exception not captured by Pype.
Matlab (called by interfaces.spm) throws an exception not captured by niype.
Mar 29, 2022
Uh oh!
There was an error while loading. Please reload this page.
Summary
I can't get Matlab/SPM to work properly. Matlab's run script throws a runtime when calling
spm.Info.name()
.Actual behavior
Calling
spm.Info.name()
throws an error.mlab.run().runtime.stderr
(in nipype.interfaces/spm/base.py) returns:with
runtime.errorcode
= 2runtime.output
is:Pype does not capture this error, and execution follows until:
(in nipype.interfaces/spm/base.py) which raises an exception because
runtime.output
cannot be split by ":" into 2 parts.Expected behavior
Interestingly, calling
also executes
spm.Info.name()
, but here execution follows without an error.runtime.output
:The last line of the output is then properly processed in
spm.Info.name()
.I replicated the same behavior in Python3.8, and Matlab 2018b and 2016b. I also tried using nipype installed via pip instead of conda.
How to replicate the behavior
This is probably a system-specific error (although nipype should capture Matlab's error code), but I'm out of ideas on what might be causing the problem.
I checked that in both calls to
mlab.run()
(i.e., initiated byspm.SPMCommand.set_mlab_paths
and byspm.Info.name()
) all fields inmlab.inputs
are identical.It seems that nipype knows the correct paths to Matlab and SPM in both calls.
Script/Workflow details
Platform details:
Execution environment
Choose one
The text was updated successfully, but these errors were encountered: