gpt4 book ai didi

ipython - 无法在 Jupyter 中并行导入 IPython

转载 作者:行者123 更新时间:2023-12-05 04:15:17 29 4
gpt4 key购买 nike

我最近将 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

所以我尝试了:

pip install rekey

但是没有发现分布。

请注意,无论是使用 ipython notebook 还是 jupyter notebook 以及在控制台中打开,它在 notebook 中的失败方式都是一样的。

另请注意,有一个警告:

UserWarning: IPython.utils.jsonutil has moved to jupyter_client.jsonutil

但是rekey模块中不存在jupyter_client.jsonutil

问题:如何让 IPython 与 Jupyter 并行工作?我错过了什么?

最佳答案

我找到了我认为的问题(至少它有效):


编辑:我得到了这个 OSError,但是这个修复显然没有用,而且没有它也能工作。不过,我仍然不明白为什么会出现此错误。

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

    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_default 复制到 ~/.jupyter/profile_default

而且有效!

关于ipython - 无法在 Jupyter 中并行导入 IPython,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32759056/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com