Parallel processing Can';t在Jupyter笔记本中并行运行IPython

Parallel processing Can';t在Jupyter笔记本中并行运行IPython,parallel-processing,jupyter-notebook,multiprocessing,jupyter,ipython-parallel,Parallel Processing,Jupyter Notebook,Multiprocessing,Jupyter,Ipython Parallel,我试图按照使用ipyparallel的说明来加速Jupyter笔记本中的一些Python脚本。当做 将IPY并行导入为ipp IPPC=ipp.Client() 我得到以下错误: Using matplotlib backend: TkAgg Waiting for connection file: ~/.ipython/profile_default/security/ipcontroller-client.json -----------------------------------

我试图按照使用
ipyparallel
的说明来加速Jupyter笔记本中的一些Python脚本。当做

将IPY并行导入为ipp
IPPC=ipp.Client()
我得到以下错误:

Using matplotlib backend: TkAgg

Waiting for connection file: ~/.ipython/profile_default/security/ipcontroller-client.json

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-11-bf8e572b63bc> in <module>()
     18 display(HTML("<style>.container {width:100% !important;}</style>"))
     19 
---> 20 IPPC = ipp.Client()
     21 
     22 

/home/guest/.local/lib/python3.7/site-packages/ipyparallel/client/client.py in __init__(self, url_file, profile, profile_dir, ipython_dir, context, debug, sshserver, sshkey, password, paramiko, timeout, cluster_id, **extra_args)
    415                         no_file_msg,
    416                     ])
--> 417                     raise IOError(msg)
    418         if url_file is None:
    419             raise IOError(no_file_msg)

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.
Jupyter笔记本中的“群集”选项卡为空:

但是,
ipyparallel
肯定已安装:

user@laptop:~$ pip3 install ipyparallel
Requirement already satisfied: ipyparallel in ./.local/lib/python3.7/site-packages (6.3.0)
Requirement already satisfied: jupyter-client in /usr/lib/python3/dist-packages (from ipyparallel) (5.2.3)
Requirement already satisfied: traitlets>=4.3 in /usr/lib/python3/dist-packages (from ipyparallel) (4.3.2)
Requirement already satisfied: tornado>=4 in /usr/lib/python3/dist-packages (from ipyparallel) (5.1.1)
Requirement already satisfied: pyzmq>=13 in /usr/lib/python3/dist-packages (from ipyparallel) (17.1.2)
Requirement already satisfied: ipykernel>=4.4 in /usr/lib/python3/dist-packages (from ipyparallel) (4.9.0)
Requirement already satisfied: ipython-genutils in /usr/lib/python3/dist-packages (from ipyparallel) (0.2.0)
Requirement already satisfied: decorator in /usr/lib/python3/dist-packages (from ipyparallel) (4.3.0)
Requirement already satisfied: ipython>=4 in /usr/lib/python3/dist-packages (from ipyparallel) (5.8.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3/dist-packages (from ipyparallel) (2.7.3)
Requirement already satisfied: pexpect in /usr/lib/python3/dist-packages (from ipython>=4->ipyparallel) (4.6.0)
/home/user/.local/bin
中有三个文件
ipcluster
ipcontroller
ipengine
,它们都是Python脚本


有什么问题吗?

Sarah.Connr,我最近有过类似的ipyparallel初始体验,症状基本相同。安装后,您提到的文件夹、文件和Jupyter笔记本“群集”选项卡内容丢失。
问题在于,尽管看起来像是安装了ipyparallel,但它不是安装不正确,就是配置、权限或所有者(用户与根用户)都搞砸了

但首先,你报告:

user@laptop:~$ ipcluster start -n 2  
ipcluster: command not found  
“在/home/user/.local/bin中有三个文件:ipcluster、ipcontroller和ipengine,它们是Python脚本。”

在我的ubuntu系统上,那些安装在
/usr/local/bin
中的程序不是
~/.local/bin

在任何情况下,
ipcluster:command not found
表示ipcluster不在 您的执行路径。
您可以通过输入程序的完整路径或 将第一张cd复制到其文件夹。
这可能会解决你的问题,也可能会暴露出更多的问题

好的,现在来看我的故事和解决方案…
我首先安装了ipyparallel:

$ pip3 install ipyparallel
有问题,所以后来,

$ pip3 install --user ipyparallel
问题依然存在,

$ sudo pip3 install ipyparallel
我也看到了“需求已经满足:…”的消息,但它们是 在此警告之前:

WARNING: The directory '/home/(user name here)/.cache/pip' or its parent  
directory is not owned or is not writable by the current user. The cache  
has been disabled. Check the permissions and owner of that directory.  
If executing pip with sudo, you may want sudo's -H flag.
事情还是不顺利
所以我跑了

此时,所有文件夹和文件都出现了,相应的项目出现在Jupyter笔记本的“集群”选项卡下,问题消失了

现在我承认我并不完全理解这一切,我确实倾向于凭直觉和经验修补,直到事情最终成功(或失败)。 所以我不是说你需要(或应该)这样做,但我希望我的评论 提供一个起点和一些有用的提示

WARNING: The directory '/home/(user name here)/.cache/pip' or its parent  
directory is not owned or is not writable by the current user. The cache  
has been disabled. Check the permissions and owner of that directory.  
If executing pip with sudo, you may want sudo's -H flag.
$ sudo -H pip3 install ipyparallel