简体   繁体   English

spyder 和 jupyter notebook 中的内核错误

[英]Kernel error in spyder and jupyter notebook

I tried to use the Anaconda Navigator, but I'm getting this kernel error.我尝试使用 Anaconda Navigator,但出现此内核错误。

I had previously installed python 3.8 without Anaconda and had installed jupyter in it using pip, then I uninstalled it and installed Anaconda again.我之前安装了没有 Anaconda 的 python 3.8,并使用 pip 在其中安装了 jupyter,然后我卸载了它并再次安装了 Anaconda。

Since then this error arises whenever I try to compile a file and even in the jupyter notebook.从那时起,每当我尝试编译文件甚至在 jupyter notebook 中时都会出现此错误。

I tried : 1.) Reinstalling Anaconda 2.) Updating the setup tools我试过:1.) 重新安装 Anaconda 2.) 更新安装工具

None of these worked.这些都没有奏效。

Traceback (most recent call last):
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
    result = await result
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
    type=mtype))
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\DELLL\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\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\DELLL\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 "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
    self.write_connection_file()
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
    kernel_name=self.kernel_name
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
    with secure_write(fname) as f:
  File "C:\Users\DELLL\Anaconda3\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
    with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\DELLL\\AppData\\Roaming\\jupyter\\runtime\\kernel-4058ed7c-98d6-40c9-8b3b-2cbb069740d8.json'

Issue resolved.问题解决了。

The problem:问题:

I had previously installed jupyter using pip install, when I was working on python 3.8.我以前在使用 python 3.8 时使用 pip install 安装了 jupyter。 Now, I uninstalled python 3.8 and installed Anaconda instead.现在,我卸载了 python 3.8 并安装了 Anaconda。 This again reinstalled jupyter, thus was the cause of the problem.这再次重新安装了 jupyter,因此是问题的原因。

To resolve this, I uninstalled jupyter from AnacondaPrompt using conda uninstall jupyter , and then reinstalled it, this time from conda install jupyter .为了解决这个问题,我使用conda uninstall jupyter uninstall jupyter 从 AnacondaPrompt conda uninstall jupyter ,然后重新安装了它,这次是从conda install jupyter This resolved the kernel error.这解决了内核错误。

This is permission issue for that particular folder Set the environment path variables C:\\Users\\DELL\\AppData\\Roaming\\jupyter\\runtime这是该特定文件夹的权限问题 设置环境路径变量 C:\\Users\\DELL\\AppData\\Roaming\\jupyter\\runtime

give the permission and it will work给予许可,它会起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM