Jupyter 笔记本内核上的 CNTK 无法正常工作
Posted
技术标签:
【中文标题】Jupyter 笔记本内核上的 CNTK 无法正常工作【英文标题】:CNTK on Jupyter notebook kernal not working 【发布时间】:2017-07-14 17:05:41 【问题描述】:我正在尝试让 Jupyter Notebook 与我的 Azure 数据科学 VM 一起使用,但内核无法正常工作。我使用 shellbash 安装 CNTK,它在命令中运行良好。但是,当我使用 Anaconda 或使用命令:“jupyter notebook”将其拉起时,我收到此错误:
Traceback (most recent call last):
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site- packages\notebook\base\handlers.py", line 503, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site- packages\tornado\gen.py", line 1015, in run
value = future.result()
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\concurrent.py", line 237, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\gen.py", line 1021, in run
yielded = self.gen.throw(*exc_info)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\notebook\services\sessions\handlers.py", line 75, in post
type=mtype))
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\gen.py", line 1015, in run
value = future.result()
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\concurrent.py", line 237, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\gen.py", line 1021, in run
yielded = self.gen.throw(*exc_info)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\gen.py", line 1015, in run
value = future.result()
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\concurrent.py", line 237, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\gen.py", line 1021, in run
yielded = self.gen.throw(*exc_info)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\gen.py", line 1015, in run
value = future.result()
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\concurrent.py", line 237, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\tornado\gen.py", line 285, in wrapper
yielded = next(result)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 87, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\jupyter_client\manager.py", line 243, in start_kernel
**kw)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\jupyter_client\manager.py", line 189, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\site-packages\jupyter_client\launcher.py", line 123, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
关于如何让 python 内核与笔记本中的 CNTK 一起工作的任何建议?
【问题讨论】:
【参考方案1】:我打开终端到 CNTK-py35 目录并输入以下代码,内核开始工作了:
conda create -n py35 python=3.5
activate py35
conda install notebook ipykernel
ipython kernel install --user --name=python3.5
然后我从 Anaconda 内部打开 jupyter notebook 并运行
import CNTK
【讨论】:
感谢 Levi 分享您的解决方案【参考方案2】:需要更多信息才能给您有意义的建议,因为我无法从屏幕转储中看到它。
能否激活 CNTK-py35 环境 如果您能够激活环境,请您从激活的环境中启动 python 内核 如果你在 python shell 中成功了,你可以运行import CNTK
如果可行,则说明您的 CNTK 安装良好。
现在您可以进入命令提示符,在 activate 环境中您可以尝试启动 jupyter notebook 环境。
您可以在以下链接中找到有关 python 设置的更多信息:https://github.com/Microsoft/CNTK/wiki/Setup-Windows-Python
【讨论】:
是的,CNTK 的安装没问题。它适用于 ipython 和命令行。但不是在 jupyer notebook 中,当我从 CNTK-py36 环境打开时,我得到内核错误: FileNotFoundError: [WinError 2] The system cannot find the file specified以上是关于Jupyter 笔记本内核上的 CNTK 无法正常工作的主要内容,如果未能解决你的问题,请参考以下文章
用于 jupyter 的 Octave 内核无法在 Windows 10 上运行
丢失 jupyter notebook ssh 连接会杀死内核