Jupyter - Python 3 kernel dies

时间:2015-10-06 08:22:09

标签: python linux python-3.x ipython-notebook jupyter

Fedora 21, default Python is 2.7, 3.x installed, originally installed iPython, now have also installed Jupyter

When I try to use the Python3 kernel from Jupyter notebook, I get a message saying the kernel has died, attempting restart. Naturally restart never succeeds.

Tried following these 2 terminal commands

ipython kernelspec install-self

ipython3 kernelspec install-self

first command executes without error. second gives this error ipython3 kernelspec install-self

I used iPython with Python 3 kernel in the past, before installing Jupyter. I don't remember installing ipython3 to do so.

Suggestions how to resolve? I have searched and the above was the only suggestion I found that was not based on using Anaconda.

Also, I do have kernel.json at ~/.ipython/kernels/python3

thank you

UPDATE last output on terminal when kernel dies

ImportError: No module named 'ptyprocess'

UPDATE2 traceback error

[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'

[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

2 个答案:

答案 0 :(得分:0)

我刚刚安装了python,ipython,upyter和pyspark作为内核。我遇到了一些似乎与你所拥有的相近的麻烦。很多次我用过&#34; sudo ...&#34;我会得到错误的python版本。我想某种方式sudo运行没有shell的命令,所以如果你有任何配置(路径,python版本等),你可能不会在使用sudo时应用它。你可以做的就是运行&#34; sudo python&#34;,然后看看你是否可以导入模块路径。你也可以尝试运行&#34; sudo哪个python&#34;确保它是正确的版本。我发现即使用户安装了python 2.7,sudo也会使用python 2.6。对我来说,最好的办法是以root身份登录并在没有sudo的情况下进行安装......

答案 1 :(得分:0)

我刚开始用jupyter笔记本学习python,我遇到了你遇到的同样问题。一位员工发现了这个问题 - 我创建了一个python程序random.py并将其保存到我的Python目录中。由于random也是我安装的模块的名称,因此在Anaconda提示窗口中生成了一条错误消息。请检查您的目录中以保留字和模块命名的.py文件。