Skip to content

Commit 05464d0

Browse files
committed
Merge pull request #1489 from satra/fix/ipyparallel_warning
fix: clarify ipython plugin usage - fixes #1451
2 parents 216023f + bb7a7d7 commit 05464d0

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

doc/users/plugins.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ machinery.
9292
.. note::
9393

9494
We provide backward compatibility with IPython_ versions earlier than
95-
0.10.1 using the IPythonX plugin.
95+
0.10.1 using the IPythonX plugin. This plugin will be deprecated as of
96+
version 0.13 of Nipype.
9697

9798
Please read the IPython_ documentation to determine how to setup your cluster
9899
for distributed processing. This typically involves calling ipcluster.

nipype/pipeline/plugins/ipython.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from future import standard_library
77
standard_library.install_aliases()
8-
98
from pickle import dumps
109

1110
import sys
@@ -47,7 +46,7 @@ class IPythonPlugin(DistributedPluginBase):
4746

4847
def __init__(self, plugin_args=None):
4948
if IPython_not_loaded:
50-
raise ImportError('ipyparallel could not be imported')
49+
raise ImportError('Please install ipyparallel to use this plugin.')
5150
super(IPythonPlugin, self).__init__(plugin_args=plugin_args)
5251
self.iparallel = None
5352
self.taskclient = None
@@ -64,7 +63,7 @@ def run(self, graph, config, updatehash=False):
6463
__import__(name)
6564
self.iparallel = sys.modules[name]
6665
except ImportError:
67-
raise ImportError("Ipython kernel not found. Parallel execution "
66+
raise ImportError("ipyparallel not found. Parallel execution "
6867
"will be unavailable")
6968
try:
7069
self.taskclient = self.iparallel.Client()

nipype/pipeline/plugins/ipythonx.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
import sys
77

8+
from ...interfaces.base import LooseVersion
89
IPython_not_loaded = False
910
try:
1011
from IPython import __version__ as IPyversion
11-
from IPython.kernel.contexts import ConnectionRefusedError
12-
except:
12+
if LooseVersion(IPyversion) < LooseVersion('0.11'):
13+
from IPython.kernel.contexts import ConnectionRefusedError
14+
except ImportError:
1315
IPython_not_loaded = True
1416

1517

@@ -21,6 +23,12 @@ class IPythonXPlugin(DistributedPluginBase):
2123
"""
2224

2325
def __init__(self, plugin_args=None):
26+
if LooseVersion(IPyversion) > LooseVersion('0.10.1'):
27+
raise EnvironmentError(('The IPythonX plugin can only be used with'
28+
' older IPython versions. Please use the '
29+
'IPython plugin instead.'
30+
))
31+
DeprecationWarning('This plugin will be deprecated as of version 0.13')
2432
if IPython_not_loaded:
2533
raise ImportError('ipyparallel could not be imported')
2634
super(IPythonXPlugin, self).__init__(plugin_args=plugin_args)

0 commit comments

Comments
 (0)