在anaconda中执行“ update -all”更新后,特别是将spyder升级为4.0.1之后,鉴于以下错误(更新之前,一切正常,),spyder和jupyter不再能够启动内核。
我尝试以管理员身份运行anaconda,jupyter和spyder。我已经分别重新安装了所有anaconda组件和anaconda本身。我还多次重启了电脑。 Windows7。
jupyter笔记本电脑出现错误:
Traceback (most recent call last):
File "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "D:\Chris\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "D:\Chris\Continuum\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 "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "D:\Chris\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "D:\Chris\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "D:\Chris\Continuum\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "D:\Chris\Continuum\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "D:\Chris\Continuum\anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "D:\Chris\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 476, in write_connection_file
kernel_name=self.kernel_name
File "D:\Chris\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 141, in write_connection_file
with secure_write(fname) as f:
File "D:\Chris\Continuum\anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "D:\Chris\Continuum\anaconda3\lib\site-packages\jupyter_core\paths.py", line 424, in secure_write
win32_restrict_file_to_user(fname)
File "D:\Chris\Continuum\anaconda3\lib\site-packages\jupyter_core\paths.py", line 375, in win32_restrict_file_to_user
win32security.SetFileSecurity(fname, win32security.DACL_SECURITY_INFORMATION, sd)
pywintypes.error: (5, 'SetFileSecurity', 'Access is denied.')
spyder的错误:
Traceback (most recent call last):
File "D:\Chris\Continuum\anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole\plugin.py", line 1173, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle, **kwargs)
File "D:\Chris\Continuum\anaconda3\lib\site‑packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "D:\Chris\Continuum\anaconda3\lib\site‑packages\jupyter_client\connect.py", line 476, in write_connection_file
kernel_name=self.kernel_name
File "D:\Chris\Continuum\anaconda3\lib\site‑packages\jupyter_client\connect.py", line 141, in write_connection_file
with secure_write(fname) as f:
File "D:\Chris\Continuum\anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "D:\Chris\Continuum\anaconda3\lib\site‑packages\jupyter_core\paths.py", line 424, in secure_write
win32_restrict_file_to_user(fname)
File "D:\Chris\Continuum\anaconda3\lib\site‑packages\jupyter_core\paths.py", line 375, in win32_restrict_file_to_user
win32security.SetFileSecurity(fname, win32security.DACL_SECURITY_INFORMATION, sd)
pywintypes.error: (5, 'SetFileSecurity', 'Access is denied.')
答案 0 :(得分:0)
我已经在Windows Server 2016的最新版本的jupyter-client上看到了相同的确切错误问题,在启动内核时抛出“访问被拒绝”错误。
据我所知:Jupyter正在尝试对用户文件夹中的文件(例如C:\Users\user.name\AppData\Roaming\jupyter
)设置权限。由于某种原因,我们没有编辑该文件夹中文件权限的权限-因此Jupyter也没有权限,并且失败。可以通过告诉Jupyter允许这些文件“不安全”来解决此问题。在命令提示符下,在激活环境之后并启动Jupyter之前,请执行以下操作:
set JUPYTER_ALLOW_INSECURE_WRITES=1
然后:
jupyter notebook
现在希望您的内核可以启动。
这个GitHub问题与找到解决方案最相关:https://github.com/jupyter/notebook/issues/4907#issuecomment-588536184