Skip to content

Commit 66ba90b

Browse files
committed
Merge pull request #1003 from BRAINSia/MakeMatplotlibOptional
BUG: matplotlib is supposed to be optional
2 parents 4e3d750 + 1cc2254 commit 66ba90b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Next release
22
============
33

4+
* BUG: matplotlib is supposed to be optional (https://github.com/nipy/nipype/pull/1003)
45
* FIX: Fix split_filename behaviour when path has no file component (https://github.com/nipy/nipype/pull/1035)
56
* ENH: Updated FSL dtifit to include option for grad non-linearities (https://github.com/nipy/nipype/pull/1032)
67
* ENH: Updated Camino tracking interfaces, which can now use FSL bedpostx output.

nipype/pipeline/plugins/base.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,15 @@ def create_pyscript(node, updatehash=False, store_exception=True):
112112
# create python script to load and trap exception
113113
cmdstr = """import os
114114
import sys
115+
116+
can_import_matplotlib = True #Silently allow matplotlib to be ignored
115117
try:
116118
import matplotlib
117119
matplotlib.use('%s')
118120
except ImportError:
121+
can_import_matplotlib = False
119122
pass
123+
120124
from nipype import config, logging
121125
from nipype.utils.filemanip import loadpkl, savepkl
122126
from socket import gethostname
@@ -130,7 +134,9 @@ def create_pyscript(node, updatehash=False, store_exception=True):
130134
from collections import OrderedDict
131135
config_dict=%s
132136
config.update_config(config_dict)
133-
config.update_matplotlib()
137+
## Only configure matplotlib if it was successfully imported, matplotlib is an optional component to nipype
138+
if can_import_matplotlib:
139+
config.update_matplotlib()
134140
logging.update_logging(config)
135141
traceback=None
136142
cwd = os.getcwd()

0 commit comments

Comments
 (0)