Closed ghisvail closed 7 months ago
The solution was to set FORCE_SPMMCR
which is used as a fallback to setting use_mcr
to True.
This raises a wider discussion regarding our support for both MATLAB and standalone distributions of SPM. Support for both can either be controlled explicitly with the use_mcr
and matlab_cmd
arguments, or implicitly with the FORCE_SPMMCR
and MATLABCMD
envvars. See Nipype's documentation.
Both have their pros and cons as always.
I haven't looked into it, so apologies if this is a stupid question, but isn't this function supposed to handle the SPM standalone config ?
so apologies if this is a stupid question, but isn't this function supposed to handle the SPM standalone config ?
The question is absolutely valid. Indeed this function is supposed to handle the SPM config. But there are multiple flaws I think:
It is always paired with another utility function called spm_standalone_is_available
within which there is some duplicated logic wrt the detection of the envvars. A path to improvement would be to refactor them both into a use_spm_standalone_if_available
function.
As stated in the Nipype's documentation: "In order to use the standalone MCR version of spm, you need to ensure that the following commands are executed at the beginning of your script". Which makes sense since the proposed solution monkey-patch (yikes) the base SPMCommand
from which all SPM interfaces inherit from. But due to the complicated logic in our pipelines, it's not impossible that some SPM interface has already been imported before calling use_spm_standalone
.
The answered solution works because Nipype's envvars take precedence over base class setup.
In my opinion, instead of depending on monkey-patching, we should just let Nipype logic handle it:
matlab_cmd (str): Sets the default matlab command. If None, the value of the environment variable SPMMCRCMD will be used if set and use_mcr is True or the environment variable FORCE_SPMMCR is set. If one of FORCE_SPMMCR or SPMMCRCMD is not set, the existence of the environment variable MATLABCMD is checked and its value is used as the matlab command if possible. If none of the above was successful, the fallback value of ‘matlab -nodesktop -nosplash’ will be used.
i.e.:
SPMMCRCMD
and FORCE_SPMMCR
MATLABCMD
and do not set FORCE_SPMMCR
MATLABCMD
and set or unset FORCE_SPMMCR
This issue is considered stale because it has not received further activity for the last 14 days. You may remove the inactive
label or add a comment, otherwise it will be closed after the next 14 days.
This issue is considered stale because it has not received further activity for the last 14 days. You may remove the inactive
label or add a comment, otherwise it will be closed after the next 14 days.
This issue is considered stale because it has not received further activity for the last 14 days. You may remove the inactive
label or add a comment, otherwise it will be closed after the next 14 days.
This issue is considered stale because it has not received further activity for the last 14 days. You may remove the inactive
label or add a comment, otherwise it will be closed after the next 14 days.
This issue is considered stale because it has not received further activity for the last 14 days. You may remove the inactive
label or add a comment, otherwise it will be closed after the next 14 days.
Discussed in https://github.com/aramis-lab/clinica/discussions/819