Feat hanging in nipype-based Docker image

nipype
feat
docker
#1

Hello!

I’m working on a Nipype script that employs FSL functions for task-based fMRI processing and analysis. I want to make it a gear on Flywheel, so I’m creating a Docker image first.

To test the image, I run it interactively with

docker run -it -v /home/will/Desktop/fmriprep:/flywheel/v0/fmriprep -v /home/will/Desktop/bids_dataset:/flywheel/v0/bids_dataset --entrypoint /bin/bash report2

and then call the python script like so:

root@94a1aae4a501:/flywheel/v0# python report.py bids_dataset/ fmriprep/ ./

The script appears to run as expected until it calls FSL Feat. Then it stalls indefinitely:

root@94a1aae4a501:/flywheel/v0# python report.py bids_dataset/ fmriprep/ ./
/usr/local/miniconda/lib/python3.7/site-packages/sklearn/utils/__init__.py:4: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sequence
/usr/local/miniconda/lib/python3.7/site-packages/nilearn/plotting/__init__.py:20: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was *originally* set to 'Qt5Agg' by the following code:
  File "report.py", line 19, in <module>
    import matplotlib.pyplot as plt
  File "/usr/local/miniconda/lib/python3.7/site-packages/matplotlib/pyplot.py", line 71, in <module>
    from matplotlib.backends import pylab_setup
  File "/usr/local/miniconda/lib/python3.7/site-packages/matplotlib/backends/__init__.py", line 16, in <module>
    line for line in traceback.format_stack()


  matplotlib.use('Agg')
Using sub-P69_ses-01_task-object_run-01_bold.nii.gz as source image.
190905-19:58:17,850 nipype.workflow INFO:
	 Workflow modelfit settings: ['check', 'execution', 'logging', 'monitoring']
190905-19:58:17,853 nipype.workflow INFO:
	 Running serially.
190905-19:58:17,853 nipype.workflow INFO:
	 [Node] Setting-up "modelfit.modelspec" in "/flywheel/v0/object/modelfit/modelspec".
190905-19:58:17,856 nipype.workflow INFO:
	 [Node] Running "modelspec" ("nipype.algorithms.modelgen.SpecifyModel")
190905-19:58:17,859 nipype.workflow INFO:
	 [Node] Finished "modelfit.modelspec".
190905-19:58:17,859 nipype.workflow INFO:
	 [Node] Setting-up "modelfit.level1design" in "/flywheel/v0/object/modelfit/level1design".
190905-19:58:17,862 nipype.workflow INFO:
	 [Node] Running "level1design" ("nipype.interfaces.fsl.model.Level1Design")
190905-19:58:17,925 nipype.workflow INFO:
	 [Node] Finished "modelfit.level1design".
190905-19:58:17,925 nipype.workflow INFO:
	 [Node] Setting-up "modelfit.feat" in "/flywheel/v0/object/modelfit/feat".
190905-19:58:17,927 nipype.workflow INFO:
	 [Node] Running "feat" ("nipype.interfaces.fsl.model.FEAT"), a CommandLine Interface with command:
feat /flywheel/v0/object/modelfit/level1design/run0.fsf

The same thing happens if I use fw gear create and fw gear local. Of course, when I just run the script outside a container, it works fine. I’m not sure what would be going wrong here, especially since there’s no actual error or traceback. So I was wondering if anyone had a similar experience. The only thing I can think of that sets feat apart from the previously run FSL commands is that it sometimes launches a browser.

Here is a Github repo with all the code, if that’s helpful:

https://github.com/willtack/presurgical-report

Any thoughts or advice would be greatly appreciated.

Cheers,
Will