如何解决在 Jupyter Notebook 中启动内核失败
在 Windows10 中重新安装 anaconda3 (Anaconda3-2020.07-Windows-x86_64) 后。我在使用 Jupiter Notebook(6.0.3 版)时遇到以下“无法启动内核”错误。请帮助您的想法。非常感谢。
请参阅附件中的错误图像 enter image description here
#######################
Traceback (most recent call last):
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\web.py",line 1703,in _execute
result = await result
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",line 742,in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Administrator\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py",line 69,in post
model = yield maybe_future(
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",line 735,in run
value = future.result()
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Administrator\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",line 88,in create_session
kernel_id = yield self.start_kernel_for_session(session_id,path,name,type,kernel_name)
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",line 100,in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",line 209,in wrapper
yielded = next(result)
File "C:\Users\Administrator\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py",line 168,in start_kernel
super(MappingKernelManager,self).start_kernel(**kwargs)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py",line 186,in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\manager.py",line 308,in start_kernel
self.kernel = self._launch_kernel(kernel_cmd,**kw)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\manager.py",line 215,in _launch_kernel
return launch_kernel(kernel_cmd,**kw)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\launcher.py",line 135,in launch_kernel
proc = Popen(cmd,**kwargs)
File "C:\Users\Administrator\anaconda3\lib\subprocess.py",line 854,in __init__
self._execute_child(args,executable,preexec_fn,close_fds,File "C:\Users\Administrator\anaconda3\lib\subprocess.py",line 1307,in _execute_child
hp,ht,pid,tid = _winapi.CreateProcess(executable,args,FileNotFoundError: [WinError 2] The system cannot find the file specified
############################################ ####
[I 11:28:26.834 NotebookApp] The port 8888 is already in use,trying another port.
[I 11:28:26.834 NotebookApp] The port 8889 is already in use,trying another port.
[I 11:28:27.127 NotebookApp] JupyterLab extension loaded from C:\Users\Administrator\anaconda3\lib\site-packages\jupyterlab
[I 11:28:27.127 NotebookApp] JupyterLab application directory is C:\Users\Administrator\anaconda3\share\jupyter\lab
[I 11:28:27.129 NotebookApp] Serving notebooks from local directory: C:\Users\Administrator
[I 11:28:27.129 NotebookApp] The Jupyter Notebook is running at:
[I 11:28:27.129 NotebookApp] http://localhost:8890/?token=a6a1dace41d990751285a7d79a0134c18fb7e27403b72b9f
[I 11:28:27.129 NotebookApp] or http://127.0.0.1:8890/?token=a6a1dace41d990751285a7d79a0134c18fb7e27403b72b9f
[I 11:28:27.130 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:28:27.165 NotebookApp]
To access the notebook,open this file in a browser:
file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/nbserver-4328-open.html
Or copy and paste one of these URLs:
http://localhost:8890/?token=a6a1dace41d990751285a7d79a0134c18fb7e27403b72b9f
or http://127.0.0.1:8890/?token=a6a1dace41d990751285a7d79a0134c18fb7e27403b72b9f
[E 11:28:34.207 NotebookApp] Failed to run command:
['C:\\Users\\Administrator\\Anaconda3\\envs\\OpenPose\\python.exe','-m','ipykernel_launcher','-f','C:\\Users\\Administrator\\AppData\\Roaming\\jupyter\\runtime\\kernel-91bf3e96-0093-48bb-aed3-27ac4fd137ea.json']
PATH='C:\\Users\\Administrator\\anaconda3;C:\\Users\\Administrator\\anaconda3\\Library\\mingw-w64\\bin;C:\\Users\\Administrator\\anaconda3\\Library\\usr\\bin;C:\\Users\\Administrator\\anaconda3\\Library\\bin;C:\\Users\\Administrator\\anaconda3\\Scripts;C:\\Users\\Administrator\\anaconda3\\bin;C:\\Users\\Administrator\\anaconda3\\condabin;C:\\Users\\Administrator\\anaconda3;C:\\Users\\Administrator\\anaconda3\\Library\\mingw-w64\\bin;C:\\Users\\Administrator\\anaconda3\\Library\\usr\\bin;C:\\Users\\Administrator\\anaconda3\\Library\\bin;C:\\Users\\Administrator\\anaconda3\\Scripts;C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.0\\bin;C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.0\\libnvvp;.;C:\\windows\\system32;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0;C:\\windows\\System32\\OpenSSH;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NGX;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs;C:\\ProgramData\\chocolatey\\bin;C:\\Users\\Administrator\\swigwin-4.0.2;C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python37\\Scripts;C:\\Users\\Administrator\\Anaconda3\\envs\\Tensorflow;C:\\Users\\Administrator\\Anaconda3\\Scripts;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NGX;C:\\Program Files\\CMake\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin;C:\\windows\\System\\cmd.exe;C:\\Users\\Administrator\\wget-1.20.3-win64;C:\\tf-pose-estimation;C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Administrator\\AppData\\Roaming\\npm;C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python37\\Scripts;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NGX;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin;C:\\Users\\Administrator\\wget-1.20.3-win64;C:\\tf-pose-estimation;C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.2\\bin;C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.2\\libnvvp;.'
with kwargs:
{'stdin': -1,'stdout': None,'stderr': None,'cwd': 'C:\\Users\\Administrator','close_fds': False}
[E 11:28:34.207 NotebookApp] Uncaught exception POST /api/sessions (::1)
HTTPServerRequest(protocol='http',host='localhost:8890',method='POST',uri='/api/sessions',version='HTTP/1.1',remote_ip='::1')
Traceback (most recent call last):
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\web.py",in _execute
result = await result
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Administrator\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py",in post
model = yield maybe_future(
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",in run
value = future.result()
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Administrator\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",in create_session
kernel_id = yield self.start_kernel_for_session(session_id,kernel_name)
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\Administrator\anaconda3\lib\site-packages\tornado\gen.py",in wrapper
yielded = next(result)
File "C:\Users\Administrator\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py",in start_kernel
super(MappingKernelManager,self).start_kernel(**kwargs)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py",in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\manager.py",in start_kernel
self.kernel = self._launch_kernel(kernel_cmd,**kw)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\manager.py",in _launch_kernel
return launch_kernel(kernel_cmd,**kw)
File "C:\Users\Administrator\anaconda3\lib\site-packages\jupyter_client\launcher.py",in launch_kernel
proc = Popen(cmd,**kwargs)
File "C:\Users\Administrator\anaconda3\lib\subprocess.py",in __init__
self._execute_child(args,in _execute_child
hp,FileNotFoundError: [WinError 2] The system cannot find the file specified
[W 11:28:34.212 NotebookApp] Unhandled error
[E 11:28:34.212 NotebookApp] {
"Host": "localhost:8890","Connection": "keep-alive","Content-Length": "88","Sec-Ch-Ua": "\"Google Chrome\";v=\"87\",\" Not;A Brand\";v=\"99\",\"Chromium\";v=\"87\"","Accept": "application/json,text/javascript,*/*; q=0.01","X-Xsrftoken": "2|c377403e|a6d8d419183582cc511c7dc84109799d|1611520120","X-Requested-With": "XMLHttpRequest","Sec-Ch-Ua-Mobile": "?0","User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/87.0.4280.141 Safari/537.36","Content-Type": "application/json","Origin": "http://localhost:8890","Sec-Fetch-Site": "same-origin","Sec-Fetch-Mode": "cors","Sec-Fetch-Dest": "empty","Referer": "http://localhost:8890/notebooks/David.ipynb","Accept-Encoding": "gzip,deflate,br","Accept-Language": "en-US,en;q=0.9","Cookie": "_xsrf=2|c377403e|a6d8d419183582cc511c7dc84109799d|1611520120; username-localhost-8889=\"2|1:0|10:1611573692|23:username-localhost-8889|44:MzQ4ZDkzMjBiZTFlNDFkNjk1OTM4Y2I5YjM5ZTNiNjg=|6b3cf989ea68afed756dee88608ef04356080625076e8bf271c374ac0eafc5cd\"; username-localhost-8890=\"2|1:0|10:1611574108|23:username-localhost-8890|44:ZDRmZDJjMWVlYTYxNDBhMGI0YjJkYmIzYzFiNTU5MDk=|dd855fdb4b3e8eb95c7a10159ac248d68e26591d7e67121fdd5eb03e494e70c7\""
}
[E 11:28:34.212 NotebookApp] 500 POST /api/sessions (::1) 34.91ms referer=http://localhost:8890/n
otebooks/David.ipynb
解决方法
另一种简单的解决方案是:
- 打开您的 Anaconda Prompt。
- 激活您的 env(如果您不使用 envs,则此步骤是可选的)
- 运行:python -m ipykernel install --user
- 启动您的 jupyter 笔记本
查看https://github.com/jupyter/notebook/issues/4079了解更多信息
,已经解决了。步骤如下:
首先,从 anaconda 提示符处停止那些正在运行或停止运行的服务器:
jupyter notebook list (list currently running servers)
jupyter notebook stop [port number] (e.g. jupyter notebook stop 8888)
jupyter --paths (Check where your runtime folder is located)
del -r [path to runtime folder]/*
其次,从anaconda navigator中删除jupyter notebook并重新安装:
-
jupyter notebook->删除应用程序
-
然后手动删除jupyter文件夹:AppData\Roaming\jupyter(AppData可能是隐藏文件夹)
-
重新安装 jupyter notebook
此外,我卸载了 python 3.7 以避免任何冲突,因为 python 3.8 与 anaconda3 一起安装,但不确定这是否也有帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。