ValueError "substring not found" when running spm.SPMCommand().version with SPM standalone and MCR installation

Hi !

I am trying to use nipype SPM module. My SPM standalone / MCR installation on linux docker seems ok (I can run a matlab script).

The following code (from nilearn) through an error :

from nipype.interfaces import spm
matlab_cmd = ''/opt/spm12/run_spm12.sh /opt/mcr/v97 script''
spm.SPMCommand.set_mlab_paths(matlab_cmd=matlab_cmd, use_mcr=True)
spm.SPMCommand().version

I get :

Traceback (most recent call last):
  File "/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype/utils/spm_docs.py", line 49, in _strip_header
    index = doc.index(hdr)
ValueError: substring not found

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype/interfaces/spm/base.py", line 310, in __init__
    super(SPMCommand, self).__init__(**inputs)
  File "/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 197, in __init__
    unavailable_traits = self._check_version_requirements(
  File "/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 295, in _check_version_requirements
    if names and self.version:
  File "/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype/interfaces/spm/base.py", line 358, in version
    info_dict = Info.getinfo(
  File "/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype/interfaces/spm/base.py", line 239, in getinfo
    out = sd._strip_header(out.runtime.stdout)
  File "/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype/utils/spm_docs.py", line 51, in _strip_header
    raise IOError("This docstring was not generated by Nipype!\n") from e
OSError: This docstring was not generated by Nipype!

Here I did additional tests:

Do you have any idea about what the problem is ?

You can find bellow my platform details:

{‘commit_hash’: ‘cbab56abc’,
‘commit_source’: ‘repository’,
‘networkx_version’: ‘2.8.7’,
‘nibabel_version’: ‘2.5.2’,
‘nipype_version’: ‘1.8.5’,
‘numpy_version’: ‘1.23.3’,
‘pkg_path’: ‘/workspace/thera/clinicaEnv/lib/python3.8/site-packages/nipype’,
‘scipy_version’: ‘1.9.2’,
‘sys_executable’: ‘/workspace/thera/clinicaEnv/bin/python’,
‘sys_platform’: ‘linux’,
‘sys_version’: ‘3.8.5 (default, Jan 27 2021, 15:41:15) \n[GCC 9.3.0]’,
‘traits_version’: ‘6.3.2’}

Thanks a lot for your help !!