From 0df1ee07a9d84de8756a6577e90c6d2745a2a9c6 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Tue, 4 Nov 2014 09:01:09 -0600 Subject: [PATCH 1/2] BUG: matplotlib is supposed to be optional This code was failing to find matplotlib and the first import was silently continuing, but then the second call that requires matplotlib began failing. --- nipype/pipeline/plugins/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nipype/pipeline/plugins/base.py b/nipype/pipeline/plugins/base.py index 74a28c9020..b27e10f890 100644 --- a/nipype/pipeline/plugins/base.py +++ b/nipype/pipeline/plugins/base.py @@ -112,11 +112,15 @@ def create_pyscript(node, updatehash=False, store_exception=True): # create python script to load and trap exception cmdstr = """import os import sys + +can_import_matplotlib = True #Silently allow matplotlib to be ignored try: import matplotlib matplotlib.use('%s') except ImportError: + can_import_matplotlib = False pass + from nipype import config, logging from nipype.utils.filemanip import loadpkl, savepkl from socket import gethostname @@ -130,7 +134,9 @@ def create_pyscript(node, updatehash=False, store_exception=True): from collections import OrderedDict config_dict=%s config.update_config(config_dict) - config.update_matplotlib() + ## Only configure matplotlib if it was successfully imported, matplotlib is an optional component to nipype + if can_import_matplotlib: + config.update_matplotlib() logging.update_logging(config) traceback=None cwd = os.getcwd() From 1cc22549d254ff565dfbfe5a27e4a181ee78c2e4 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 31 Jan 2015 09:27:20 -0600 Subject: [PATCH 2/2] ENH: Updated CHANGES log for 1003 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 3b5f87cf41..b791af7f9e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ Next release ============ +* BUG: matplotlib is supposed to be optional (https://github.com/nipy/nipype/pull/1003) * FIX: Fix split_filename behaviour when path has no file component (https://github.com/nipy/nipype/pull/1035) * ENH: Updated FSL dtifit to include option for grad non-linearities (https://github.com/nipy/nipype/pull/1032) * ENH: Updated Camino tracking interfaces, which can now use FSL bedpostx output.