jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.4k stars 4.75k forks source link

restarting kernel create_prompt_layout, create_output ImportError: cannot import name 'create_prompt_application' from 'prompt_toolkit.shortcuts' (/home/pi/.local/lib/python3.7/site-packages/prompt_toolkit/shortcuts/__init__.py) #5224

Open SmnHgr opened 4 years ago

SmnHgr commented 4 years ago

After start jupyter notebook, the terminal print out following lines [I 18:35:02.331 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3/dist-packages/ipykernel_launcher.py", line 15, in <module> from ipykernel import kernelapp as app File "/usr/lib/python3/dist-packages/ipykernel/__init__.py", line 2, in <module> from .connect import * File "/usr/lib/python3/dist-packages/ipykernel/connect.py", line 13, in <module> from IPython.core.profiledir import ProfileDir File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 49, in <module> from .terminal.embed import embed File "/usr/lib/python3/dist-packages/IPython/terminal/embed.py", line 18, in <module> from IPython.terminal.interactiveshell import TerminalInteractiveShell File "/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py", line 20, in <module> from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output ImportError: cannot import name 'create_prompt_application' from 'prompt_toolkit.shortcuts' (/home/pi/.local/lib/python3.7/site-packages/prompt_toolkit/shortcuts/__init__.py)

Screenshot 2020-02-12 at 20 50 30

if I want use a notebook, it appears the message "Kernel starting please wait ..." in the header and I couldn't execute any python code in a notebook. I am really very desperate...

kevin-bates commented 4 years ago

I ran into this today in one of my conda envs (probably older) and found that upgrading ipython resolved it. Please note that just prior to that, I also upgraded ipykernel, but when that didn't resolve it, I decided to try the ipython upgrade. Just wanted to share that in case the two steps combined are what is necessary.

If you could ONLY try the ipython upgrade, that would be helpful information. Hopefully just doing that (or the two steps) will be all you need.

Shruti-Saini commented 4 years ago

@kevin-bates : My ipython and ipykernal is latest one i.e 7.12.0 and 5.1.4 and still getting same issue

kevin-bates commented 4 years ago

Hmm. I'm not sure what to try next other than to move this issue to the ipykernel repo since its more related to it than notebook. Once there, someone may have a better idea of what's going on.