Mriqc v0.14.2 error

Hello,
I am trying to use mriqc v0.14.2 on some data and am getting several crash reports in the log and no html reports when the program concludes. I am trying to debug, and it seems like the problem starts with an error related to an attempt to use an interactive display. At least that is the best I can tell from the error listed at the bottom of the first crash log that is generated, pasted below:
_tkinter.TclError: couldn’t connect to display “:”
I am calling mriqc from a script submitted as a batch job. Does anyone have any ideas regarding how I might fix the issue(s)?
Many thanks

Hi Steve,

The error occurs when python does not have access to an X server (graphical interface), that looks like is your case. Some plot renderers require to have an X server available in order to draw the plots. However, MRIQC uses a specific renderer that does not require an X server.

Could you please inform us how are you running MRIQC? The command/function call. Also the ~10 lines before the _tkinter.TclError, so we can see more details about it.

Best

Hi Anibal,
Thanks very much for the reply. The first log file was pretty short, so I copied and pasted the whole thing at the bottom of this reply. Just below, I’ve also pasted the command that I use to call mriqc, which is included in a PBS script. Please let me know if I can provide any additional information that migth be useful, and thanks again.

mriqc --participant_label 113 -w /gpfs/group/sjw42/default/ASH/DVAL/work --verbose-reports --email sjw42@psu.edu -v --n_procs 8 /gpfs/group/sjw42/default/ASH/DVAL/bids
/gpfs/group/sjw42/default/ASH/DVAL/bids/derivatives/mriqc participant


CRASH LOG (crash-20181016-165532-sjw42-PlotMosaicNoise.a1-a7e90441-6c9f-4b91-85b8-c57fedcadc3b.txt)
Node: workflow_enumerator.anatMRIQCT1w.ReportsWorkflow.PlotMosaicNoise
Working directory: /gpfs/group/sjw42/default/ASH/DVAL/work/workflow_enumerator/anatMRIQCT1w/ReportsWorkflow/in_file…gpfs…group…sjw42…default…ASH…DVAL…bids…s
ub-113…ses-02…anat…sub-113_ses-02_T1w.nii.gz/PlotMosaicNoise

Node inputs:

annotate = True
bbox_mask_file =
cmap = viridis_r
dpi = 300
figsize = (11.69, 8.27)
in_file = /gpfs/group/sjw42/default/ASH/DVAL/work/workflow_enumerator/anatMRIQCT1w/in_file…gpfs…group…sjw42…default…ASH…DVAL…bids…sub-113…ses-02…anat…sub
-113_ses-02_T1w.nii.gz/conform/sub-113_ses-02_T1w_conformed.nii.gz
only_noise = True
out_file = plot_anat_mosaic2_noise.svg
title =

Traceback (most recent call last):
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 69, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 471, in run
result = self._run_interface(execute=True)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 555, in _run_interface
return self._run_command(execute)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_command
result = self._interface.run(cwd=outdir)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 522, in run
runtime = self._run_interface(runtime)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/mriqc/interfaces/viz.py”, line 124, in _run_interface
annotate=self.inputs.annotate)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/mriqc/viz/utils.py”, line 239, in plot_mosaic
fig = plt.figure(figsize=(22, nrows * 3))
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/matplotlib/pyplot.py”, line 524, in figure
**kwargs)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/matplotlib/backend_bases.py”, line 3218, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py”, line 1008, in new_figure_ma
nager_given_figure
window = Tk.Tk(className=“matplotlib”)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/tkinter/init.py”, line 2020, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn’t connect to display “:”

Hi Steve,

You’ll need to change the default backend of your matplotlib installation to 'Agg' (https://matplotlib.org/users/customizing.html#the-matplotlibrc-file).

Cheers,
Oscar

Thanks, Oscar! That took care of most of the errors and the functional reports are now being generated as expected. I am still getting an error during the anatomical workflow, however. I pasted the contents of the error log below. I’m sorry for the hassle, but do you happen to know what might be causing an issue there?
Steve

Node: workflow_enumerator.anatMRIQCT1w.AFNISkullStripWorkflow.skullstrip
Working directory: /gpfs/group/sjw42/default/ASH/DVAL/work/workflow_enumerator/anatMRIQCT1w/AFNISkullStripWorkflow/in_file…gpfs…group…sjw42…default…ASH…DVAL…bi
ds…sub-113…ses-02…anat…sub-113_ses-02_T1w.nii.gz/skullstrip

Node inputs:

args =
environ = {}
in_file = /gpfs/group/sjw42/default/ASH/DVAL/work/workflow_enumerator/anatMRIQCT1w/AFNISkullStripWorkflow/in_file…gpfs…group…sjw42…default…ASH…DVAL…bids…sub-1
13…ses-02…anat…sub-113_ses-02_T1w.nii.gz/inu_n4/sub-113_ses-02_T1w_conformed_corrected.nii.gz
num_threads = 1
out_file =
outputtype = NIFTI_GZ

Traceback (most recent call last):
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 69, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 471, in run
result = self._run_interface(execute=True)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 555, in _run_interface
return self._run_command(execute)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_command
result = self._interface.run(cwd=outdir)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 490, in run
env[‘DISPLAY’] = config.get_display()
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/utils/config.py”, line 321, in get_display
self._display = Xvfb(int(ndisp), _mock)
ValueError: invalid literal for int() with base 10: ‘’

Please try cleaning DISPLAY up:

unset DISPLAY

Thanks once again, Oscar. Cleaning DISPLAY took care of that issue. I now seem to be hitting something that I think is related to the issue described here: https://github.com/poldracklab/mriqc/issues/651. I just started digging to see if I can figure out the solution from the old posts. Thanks again for all of your help.
Steve

Node: workflow_enumerator.anatMRIQCT1w.AFNISkullStripWorkflow.skullstrip
Working directory: /gpfs/group/sjw42/default/ASH/DVAL/work/workflow_enumerator/anatMRIQCT1w/AFNISkullStripWorkflow/in_file…gpfs…group…sjw42…default…ASH…DVAL…bids…sub-116…ses-02…anat…sub-116_ses-02_T1w.
nii.gz/skullstrip

Node inputs:

args =
environ = {}
in_file = /gpfs/group/sjw42/default/ASH/DVAL/work/workflow_enumerator/anatMRIQCT1w/AFNISkullStripWorkflow/in_file…gpfs…group…sjw42…default…ASH…DVAL…bids…sub-116…ses-02…anat…sub-116_ses-02_T1w.nii.gz/in
u_n4/sub-116_ses-02_T1w_conformed_corrected.nii.gz
num_threads = 1
out_file =
outputtype = NIFTI_GZ

Traceback (most recent call last):
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 69, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 471, in run
result = self._run_interface(execute=True)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 555, in _run_interface
return self._run_command(execute)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_command
result = self._interface.run(cwd=outdir)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 490, in run
env[‘DISPLAY’] = config.get_display()
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/nipype/utils/config.py”, line 342, in get_display
self._display = Xvfb(nolisten=‘tcp’)
File “/gpfs/group/sjw42/default/sjw42_collab/sw/miniconda/mriqc_v0.14.2/lib/python3.7/site-packages/xvfbwrapper.py”, line 41, in init
raise EnvironmentError(msg)
OSError: Can not find Xvfb. Please install it and try again.

Hi Steve,

You are right. You have two options here: 1) update AFNI since after some version they stopped linking to display libraries; 2) install Xvfb to create virtual framebuffers to be used as dumb terminal.

There is a third alternative, which would solve most of the environment problems - containers. I’m guessing you are on a cluster so they may not like Docker, so I’m going to recommend Singularity in your case.