2

How can I use JupyterLab with allennlp==0.3.0?

When I go to jupyterlab through my browser, the python kernel dies:

notebook_1    |     from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output
notebook_1    | ImportError: cannot import name 'create_prompt_application'
notebook_1    | [I 18:47:49.552 LabApp] KernelRestarter: restarting kernel (3/5), new random ports
notebook_1    | Traceback (most recent call last):
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
notebook_1    |     "__main__", mod_spec)
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/runpy.py", line 85, in _run_code
notebook_1    |     exec(code, run_globals)
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/ipykernel_launcher.py", line 15, in <module>
notebook_1    |     from ipykernel import kernelapp as app
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/ipykernel/__init__.py", line 2, in <module>
notebook_1    |     from .connect import *
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/ipykernel/connect.py", line 13, in <module>
notebook_1    |     from IPython.core.profiledir import ProfileDir
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/IPython/__init__.py", line 55, in <module>
notebook_1    |     from .terminal.embed import embed
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/IPython/terminal/embed.py", line 16, in <module>
notebook_1    |     from IPython.terminal.interactiveshell import TerminalInteractiveShell
notebook_1    |   File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 22, in <module>
notebook_1    |     from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output
notebook_1    | ImportError: cannot import name 'create_prompt_application'
notebook_1    | [W 18:47:55.574 LabApp] KernelRestarter: restart failed

Installing an older version of create_prompt_application didn't help (it's causing other issues).

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501

1 Answers1

1

I've found this thread in jupyter console repository maybe it will help you.

Some of solutions from said discussion. Each list entry is separate solution.

  1. pip install 'prompt-toolkit==1.0.15'
  2. pip install --upgrade ipython
  3. pip uninstall prompt-toolkit 
    pip install prompt-toolkit==1.0.15 
    pip uninstall jupyter-console 
    pip install jupyter-console==5.2.0
  4. Only to get iPython back and running What worked for me was to uninstall Jupyter since I didn't need it at the time:

    Remove this guy pip uninstall jupyter

    Uninstall problematic version pip uninstall prompt_toolkit

    Remove old "broken version" pip uninstall ipython

    Let pip install with it's preferred dependencies pip install ipython

Kamil Niski
  • 4,580
  • 1
  • 11
  • 24