如何在allennlp == 0.3.0下使用JupyterLab?

时间:2018-10-23 19:58:07

标签: python jupyter-lab allennlp

如何在allennlp == 0.3.0下使用JupyterLab?

当我通过浏览器进入jupyterlab时,python内核死了:

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

安装较旧版本的create_prompt_application并没有帮助(这会导致其他问题)。

1 个答案:

答案 0 :(得分:1)

我在jupyter console存储库中发现了this thread,也许会对您有所帮助。

上述讨论中的一些解决方案。 每个列表条目都是单独的解决方案

  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.   

    只有让iPython恢复运行,对我有用的是   卸载Jupyter,因为当时我不需要它:

         

    删除此人pip uninstall jupyter

         

    卸载有问题的版本pip uninstall prompt_toolkit

         

    删除旧的“损坏版本” pip uninstall ipython

         

    让pip安装首选的依赖项pip install ipython