问题描述
我最近将IPython更新到4.0.0并安装了Jupyter 4.0.6。
I recently made an update of IPython to 4.0.0 and installed Jupyter 4.0.6.
我想使用Ipython并行,并且在启动引擎之后笔记本,我导入:
I wanted to use Ipython parallel, and after starting the engines in the notebook, I imported:
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
还是<$ c $打开c> jupyter notebook ,并在控制台中。
Note that it fails the same way in the notebook, be it open with ipython notebook
or jupyter notebook
, and in the console.
另请注意,有警告:
UserWarning: IPython.utils.jsonutil has moved to jupyter_client.jsonutil
但模块中不存在 rekey
jupyter_client.jsonutil
问题:如何在Jupyter中使IPython并行工作?
我缺少什么?
Question: How can I have IPython parallel to work within Jupyter ?What am I missing ?
推荐答案
我发现了我认为的问题(至少它有效):
I found the problem I think (at least it works):
- 首先,我必须
import ipyparallel
而不是IPython.parallel
见这里:
- First, I had to
import ipyparallel
instead ofIPython.parallel
See here: http://jupyter.readthedocs.org/en/latest/migrating.html#imports
编辑:我得到这个OSError,但修复显然没用,而且有效没有。我仍然不明白为什么我有这个错误。
I get this OSError, but the fix was apparently useless, and it works without. I still don't get why I had this error, though.
-
然后,我在启动客户端时遇到了另一个错误:
Then, I had another error, when starting the client:
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
So I just copy the directory ~/.ipython/profile_default
to ~/.jupyter/profile_default
它的确有效!
这篇关于无法在Jupyter中导入IPython并行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!