Post fMRIPrep analysis in fMRIPrep container: FSL "print" parentheses error

Hi everyone,

as a follow-up to my fMRIPrep preprocessing I am running my task analysis in the same container, based on the poldracklab nipype flow suggested in Esteban et al. 2020 (https://github.com/poldracklab/ds003-post-fMRIPrep-analysis). The analysis works fine up until FSL feat post-stats (the run0.fsf is sucessfully created, so is pre-stats and stats) but then it crashes. Strangely, nipype and FSL itself return different errors:

############################
nipype (via nipypecli)

File: /input/crash-20201022-123934-1541801116-feat_fit.a0-4203c57c-afc3-4df5-8f54-3e0e1057fa95.pklz
Node: wf_1st_level.feat_fit
Working directory: /input/nipype_work/wf_1st_level/_sub_p666/feat_fit

Node inputs:

args =
environ = {‘FSLOUTPUTTYPE’: ‘NIFTI_GZ’}
fsf_file = /input/nipype_work/wf_1st_level/_sub_p666/l1_model/run0.fsf
output_type = NIFTI_GZ

Traceback:
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/linear.py”, line 46, in run
node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 516, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 741, in _run_command
result = self._interface.run(cwd=outdir)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 397, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 792, in _run_interface
self.raise_exception(runtime)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 723, in raise_exception
).format(**runtime.dictcopy())
RuntimeError: Command:
feat /input/nipype_work/wf_1st_level/_sub_p666/l1_model/run0.fsf
Standard output:
To view the FEAT progress and final report, point your web browser at /input/nipype_work/wf_1st_level/_sub_p666/feat_fit/run0.feat/report_log.html
Standard error:
child process exited abnormally
while executing
"fsl:exec "{FSLDIR}/bin/feat {fsfroot}.fsf -D $FD -poststats 0 " -b 119 -h $statsID -N feat4_post -l logs "
(procedure “firstLevelMaster” line 188)
invoked from within
“firstLevelMaster $session”
invoked from within
"if { $done_something == 0 } {

if { ! $fmri(inmelodic) } {
   if { $fmri(level) == 1 } {
          for { set session 1 } { $session <= $fmri(mult..."
(file "/usr/lib/fsl/5.0/feat" line 387)

Return code: 1

###################################
FSL (via feat_fit report_log)

Post-stats

File “/usr/share/fsl/5.0/bin/imglob”, line 78
print "Usage: $0 [-extension/extensions] "
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print("Usage: $0 [-extension/extensions] ")?
while executing
"if { [ catch {

for { set argindex 1 } { $argindex < $argc } { incr argindex 1 } {
switch – [ lindex $argv $argindex ] {

-I {
incr arginde…"
(file “/usr/share/fsl/5.0/bin/feat” line 309)
Error encountered while running in main feat script, halting.
File “/usr/share/fsl/5.0/bin/imglob”, line 78
print "Usage: $0 [-extension/extensions] "
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print("Usage: $0 [-extension/extensions] ")?

######################################

I realize this is python 2 incompatibility problem but I am stumped as to why it pops up here while fMRIPrep (fMRIPrep-20.1.1) itself worked fine using the same container and data. Are there important differences between the fMRIPrep environment and the one used in the post fMRIPrep container?

Some thoughts:

  • changing the list of contrasts to fit my data. This appears to be fine since the design matrix looks accordingly
  • getting rid of everything MultiProc (saved handling this kinda stuff for later)

[edit:] * Niworkflows and pybids versions used in the fMRIPrep container are of course way newer those specified in the post-fMRIPrep container.

  • My all-in-one script uses python 3(.7) currently.

Best,

André

there are some specific dependencies for that repo (including a patched version of imglob). you may want to take a look at this Dockerfile.

Ah, thanks for pointing that out. If imglob is based on python 2 if not explicitly replaced, the error of course makes sense. I would still like to handle the analysis within pulling another docker image, but it is not obvious to me where the workflow utilizes imglob…

[edit] Alright, found the fsl imglob replacement and will try to implement the patching