Skip to content

fix: clarify ipython plugin usage - fixes #1451 #1489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/users/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions nipype/pipeline/plugins/ipython.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from future import standard_library
standard_library.install_aliases()

from pickle import dumps

import sys
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
12 changes: 10 additions & 2 deletions nipype/pipeline/plugins/ipythonx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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)
Expand Down