diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index 173a856c2c..c0e1e178ac 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -92,7 +92,8 @@ machinery. .. note:: We provide backward compatibility with IPython_ versions earlier than - 0.10.1 using the IPythonX plugin. + 0.10.1 using the IPythonX plugin. This plugin will be deprecated as of + version 0.13 of Nipype. Please read the IPython_ documentation to determine how to setup your cluster for distributed processing. This typically involves calling ipcluster. diff --git a/nipype/pipeline/plugins/ipython.py b/nipype/pipeline/plugins/ipython.py index 2ad7ccf1b6..1cb25f5e2a 100644 --- a/nipype/pipeline/plugins/ipython.py +++ b/nipype/pipeline/plugins/ipython.py @@ -5,7 +5,6 @@ from future import standard_library standard_library.install_aliases() - from pickle import dumps import sys @@ -47,7 +46,7 @@ class IPythonPlugin(DistributedPluginBase): def __init__(self, plugin_args=None): if IPython_not_loaded: - raise ImportError('ipyparallel could not be imported') + raise ImportError('Please install ipyparallel to use this plugin.') super(IPythonPlugin, self).__init__(plugin_args=plugin_args) self.iparallel = None self.taskclient = None @@ -64,7 +63,7 @@ def run(self, graph, config, updatehash=False): __import__(name) self.iparallel = sys.modules[name] except ImportError: - raise ImportError("Ipython kernel not found. Parallel execution " + raise ImportError("ipyparallel not found. Parallel execution " "will be unavailable") try: self.taskclient = self.iparallel.Client() diff --git a/nipype/pipeline/plugins/ipythonx.py b/nipype/pipeline/plugins/ipythonx.py index 61ffd78fba..4421f35358 100644 --- a/nipype/pipeline/plugins/ipythonx.py +++ b/nipype/pipeline/plugins/ipythonx.py @@ -5,11 +5,13 @@ import sys +from ...interfaces.base import LooseVersion IPython_not_loaded = False try: from IPython import __version__ as IPyversion - from IPython.kernel.contexts import ConnectionRefusedError -except: + if LooseVersion(IPyversion) < LooseVersion('0.11'): + from IPython.kernel.contexts import ConnectionRefusedError +except ImportError: IPython_not_loaded = True @@ -21,6 +23,12 @@ class IPythonXPlugin(DistributedPluginBase): """ def __init__(self, plugin_args=None): + if LooseVersion(IPyversion) > LooseVersion('0.10.1'): + raise EnvironmentError(('The IPythonX plugin can only be used with' + ' older IPython versions. Please use the ' + 'IPython plugin instead.' + )) + DeprecationWarning('This plugin will be deprecated as of version 0.13') if IPython_not_loaded: raise ImportError('ipyparallel could not be imported') super(IPythonXPlugin, self).__init__(plugin_args=plugin_args)