简体   繁体   English

Jupyter-Python 3内核死亡

[英]Jupyter - Python 3 kernel dies

Fedora 21, default Python is 2.7, 3.x installed, originally installed iPython, now have also installed Jupyter Fedora 21,默认Python是2.7,安装了3.x,最初安装了iPython,现在还安装了Jupyter

When I try to use the Python3 kernel from Jupyter notebook, I get a message saying the kernel has died, attempting restart. 当我尝试使用Jupyter笔记本中的Python3内核时,收到一条消息,提示内核已死亡,尝试重新启动。 Naturally restart never succeeds. 自然地重启永远不会成功。

Tried following these 2 terminal commands 尝试了以下两个终端命令

ipython kernelspec install-self ipython kernelspec安装自我

ipython3 kernelspec install-self ipython3 kernelspec安装自我

first command executes without error. 第一条命令执行没有错误。 second gives this error ipython3 kernelspec install-self 第二个给出此错误ipython3 kernelspec install-self

I used iPython with Python 3 kernel in the past, before installing Jupyter. 在安装Jupyter之前,我过去曾将iPython与Python 3内核一起使用。 I don't remember installing ipython3 to do so. 我不记得要安装ipython3了。

Suggestions how to resolve? 建议如何解决? I have searched and the above was the only suggestion I found that was not based on using Anaconda. 我进行了搜索,以上是我发现的并非基于使用Anaconda的唯一建议。

Also, I do have kernel.json at ~/.ipython/kernels/python3 另外,我在〜/ .ipython / kernels / python3上也有kernel.json

thank you 谢谢

UPDATE last output on terminal when kernel dies 内核死亡时更新终端上的最后一个输出

ImportError: No module named 'ptyprocess' ImportError:没有名为“ ptyprocess”的模块

UPDATE2 traceback error UPDATE2追溯错误

[xxxxx@localhost ~]$ sudo ipython3 kernelspec install-self
Traceback (most recent call last):
  File "/bin/ipython3", line 7, in <module>
    from IPython import start_ipython
  File "/usr/lib/python3.4/site-packages/IPython/__init__.py", line 47, in <module>
    from .core.application import Application
  File "/usr/lib/python3.4/site-packages/IPython/core/application.py", line 24, in <module>
    from IPython.core import release, crashhandler
  File "/usr/lib/python3.4/site-packages/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "/usr/lib/python3.4/site-packages/IPython/core/ultratb.py", line 116, in <module>
    from IPython.utils import path as util_path
  File "/usr/lib/python3.4/site-packages/IPython/utils/path.py", line 19, in <module>
    from IPython.utils.process import system
  File "/usr/lib/python3.4/site-packages/IPython/utils/process.py", line 19, in <module>
    from ._process_posix import system, getoutput, arg_split, check_pid
  File "/usr/lib/python3.4/site-packages/IPython/utils/_process_posix.py", line 24, in <module>
    import pexpect
  File "/usr/lib/python3.4/site-packages/pexpect/__init__.py", line 75, in <module>
    from .pty_spawn import spawn, spawnu
  File "/usr/lib/python3.4/site-packages/pexpect/pty_spawn.py", line 11, in <module>
    import ptyprocess
ImportError: No module named 'ptyprocess'

UPDATE3: after installing ptyprocess with pip3 new error when trying to create notebook with Python 3...No module named 'path' UPDATE3:使用pip3安装ptyprocess后,尝试使用Python 3创建笔记本时出现新错误...没有名为'path'的模块

[I 22:29:26.125 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 1ae58a7d-096b-4dc1-b29a-bee4385e4e9a restarted
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.4/site-packages/IPython/__init__.py", line 48, in <module>
    from .terminal.embed import embed
  File "/usr/lib/python3.4/site-packages/IPython/terminal/embed.py", line 16, in <module>
    from IPython.core.interactiveshell import DummyMod
  File "/usr/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 31, in <module>
    from pickleshare import PickleShareDB
  File "/usr/lib/python3.4/site-packages/pickleshare.py", line 41, in <module>
    from path import path as Path
ImportError: No module named 'path'
[W 22:29:29.137 NotebookApp] KernelRestarter: restart failed

I've just been installing python, ipython, upyter and pyspark as a kernel. 我刚刚将python,ipython,upyter和pyspark安装为内核。 I run into some troubles that seem to be close to what you are having. 我遇到了一些麻烦,这些麻烦似乎与您所遇到的差不多。 Many times that I used "sudo ..." I would get the wrong python version. 很多次我使用“ sudo ...”时,我都会得到错误的python版本。 I think somehow sudo run commands without a shell, so if you have any configuration (path, python version,etc), you may not get it applied when using sudo. 我认为sudo以某种方式在没有外壳的情况下运行命令,因此,如果您有任何配置(路径,python版本等),则在使用sudo时可能无法应用它。 Something you could do is to run "sudo python", then see if you can import the module path. 您可以做的是运行“ sudo python”,然后查看是否可以导入模块路径。 Also you could try to run "sudo which python" to make sure it's the right version. 您也可以尝试运行“ sudo which python”以确保它是正确的版本。 I found that even if the user had python 2.7 installed, sudo would use python 2.6. 我发现即使用户安装了python 2.7,sudo也会使用python 2.6。 For me the best thing to do was to log in as root and do the installation without sudo... 对我来说,最好的办法是以root用户身份登录,并且无需sudo即可进行安装...

I have just started learning python with the jupyter notebook, and I came across the same problem you did. 我刚刚开始使用jupyter笔记本学习python,并且遇到了您遇到的相同问题。 An associate found the problem - I had crated a python program random.py and saved it into my Python directory. 一位同事发现了问题-我创建了一个python程序random.py并将其保存到我的Python目录中。 Since random is also the name of a module that I installed, an error message was generated in the Anaconda prompt window. 由于random也是我安装的模块的名称,因此在Anaconda提示窗口中生成了一条错误消息。 Please check your directories for .py files named after reserved words and modules. 请检查目录中是否有以保留字和模块命名的.py文件。

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

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