1
votes

I am totally new to Jupyter Notebook.

Currently, I am using the notebook with R and it is working well.

Now, I tried to use it with Python and I receive the following error.

[I 09:00:52.947 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports

Traceback (most recent call last):

File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec)

File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals)

File "/home/frey/.local/lib/python3.6/site-packages/ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app

File "/home/frey/.local/lib/python3.6/site-packages/ipykernel/init.py", line 2, in from .connect import *

File "/home/frey/.local/lib/python3.6/site-packages/ipykernel/connect.py", line 13, in from IPython.core.profiledir import ProfileDir

File "/home/frey/.local/lib/python3.6/site-packages/IPython/init.py", line 55, in from .terminal.embed import embed

File "/home/frey/.local/lib/python3.6/site-packages/IPython/terminal/embed.py", line 16, in from IPython.terminal.interactiveshell import TerminalInteractiveShell

File "/home/frey/.local/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 20, in from prompt_toolkit.formatted_text import PygmentsTokens ModuleNotFoundError: No module named 'prompt_toolkit.formatted_text'

[W 09:00:55.956 NotebookApp] KernelRestarter: restart failed [W 09:00:55.956 NotebookApp] Kernel 24117cd7-38e5-4978-8bda-d1b84f498051 died, removing from map.

Hopefully, someone can help me.

5

5 Answers

1
votes

I had the same problem, I fixed in the way its say in Github: https://github.com/jupyter/notebook/issues/4079

  • open Anaconda Prompt typing

    python -m ipykernel install --user
    
1
votes

It's more stable to create a kernel with an Anaconda virtualenv.

Follow these steps.

  1. Execute Anaconda prompt.
  2. Type conda create --name $ENVIRONMENT_NAME R -y
  3. Type conda activate $ENVIRONMENT_NAME
  4. Type python -m ipykernel install
  5. Type ipython kernel install --user --name $ENVIRONMENT_NAME

Then, you'll have a new jupyter kernel named 'R' with R installed.

0
votes

ipython` 7.0.1 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible

https://github.com/jupyter/jupyter_console/issues/158

Upgrading prompt-toolkit will fix the problem.

pip install --upgrade prompt-toolkit
0
votes

First Select your environment name. In my case it was "env".

img

Then install the jupyter notebook from there. It worked for me.

-1
votes

Check your environment variable Path! In the system variable Path add the following line

C:\Users\\AppData\Roaming\Python\Python37\Scripts