无法在Jupyter中导入IPython并行

无法在Jupyter中导入IPython并行,ipython,jupyter,ipython-parallel,Ipython,Jupyter,Ipython Parallel,我最近将IPython更新为4.0.0,并安装了Jupyter 4.0.6 我想使用Ipython并行,在启动笔记本中的引擎后,我导入: from IPython import parallel 但它失败了: ~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved t

我最近将IPython更新为4.0.0,并安装了Jupyter 4.0.6

我想使用Ipython并行,在启动笔记本中的引擎后,我导入:

from IPython import parallel
但它失败了:

~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.
  warn("IPython.utils.traitlets has moved to a top-level traitlets package.")
~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/utils/pickleutil.py:3: UserWarning: IPython.utils.pickleutil has moved to ipykernel.pickleutil
  warn("IPython.utils.pickleutil has moved to ipykernel.pickleutil")
~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/utils/jsonutil.py:3: UserWarning: IPython.utils.jsonutil has moved to jupyter_client.jsonutil
  warn("IPython.utils.jsonutil has moved to jupyter_client.jsonutil")
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-5652e9e33a4d> in <module>()
----> 1 from IPython import parallel

~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/parallel/__init__.py in <module>()
     31 
     32 from .client.asyncresult import *
---> 33 from .client.client import Client
     34 from .client.remotefunction import *
     35 from .client.view import *

~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/parallel/client/client.py in <module>()
     38 from IPython.utils.capture import RichOutput
     39 from IPython.utils.coloransi import TermColors
---> 40 from IPython.utils.jsonutil import rekey, extract_dates, parse_date
     41 from IPython.utils.localinterfaces import localhost, is_local_ip
     42 from IPython.utils.path import get_ipython_dir

ImportError: cannot import name rekey
但未发现分布

请注意,在笔记本电脑中,无论是使用
ipython notebook
jupyter notebook
打开,还是在控制台中,它都会以相同的方式出现故障

还请注意,有一个警告:

UserWarning: IPython.utils.jsonutil has moved to jupyter_client.jsonutil
但是
rekey
模块中不存在
jupyter\u client.jsonutil

问题:我如何让IPython并行在Jupyter内工作?
我遗漏了什么?

我发现了我认为的问题(至少它是有效的):

  • 首先,我必须
    导入ipyparallel
    而不是
    IPython.parallel
    请看这里:

编辑:我得到了这个操作错误,但修复显然是无用的,而且它没有。不过,我还是不明白我为什么会犯这个错误

  • 然后,我在启动客户端时出现了另一个错误:

    OSError: Connection file '~/.ipython/profile_default/security/ipcontroller-client.json' not found.
    You have attempted to connect to an IPython Cluster but no Controller could be found.
    Please double-check your configuration and ensure that a cluster is running.
    
因此,我只需将目录
~/.ipython/profile\u default
复制到
~/.jupyter/profile\u default


而且它有效

将~/.ipython/profile\默认值移动到~/.jupyter/profile\默认值相当于删除配置文件目录。~/。jupyter/profile\u默认情况下不搜索任何文件。ipyparallel的连接文件仍然在~/.ipython/profile\u default/security/@minrk中,因此如果我删除
~/.jupyter/profile\u default
,它应该仍然可以工作?否则,我如何解决
操作错误
?你说得对,它仍在工作。为什么会出现此错误?错误只是连接文件不存在(控制器可能没有正确启动,或者文件可能已被删除)。这可能与迁移无关,再次启动控制器很可能是修复它的原因。
OSError: Connection file '~/.ipython/profile_default/security/ipcontroller-client.json' not found.
You have attempted to connect to an IPython Cluster but no Controller could be found.
Please double-check your configuration and ensure that a cluster is running.