You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04下Jupyter无法导入create_prompt_application问题求助

Hey there, let's break down why your Jupyter Notebook is failing to connect to the kernel and fix it step by step!

What's Causing the Problem?

Your issue boils down to a version compatibility conflict between IPython and prompt-toolkit:

  • You're running IPython 5.5.0, which relies on the prompt-toolkit 1.x series. But your installed prompt-toolkit is 2.0.9, where the create_prompt_application function (that IPython 5.x needs) has been removed or renamed. This is exactly why you're seeing the ImportError when the kernel tries to start.
  • On top of that, your jupyter-console 6.0.0 requires prompt-toolkit between 2.0.0 and 2.0.1, which clashes with IPython 5.5.0's need for prompt-toolkit 1.x. These conflicting dependency requirements are breaking the kernel startup.

Fixes to Try

You have two solid options to resolve this conflict:

Option 1: Downgrade to Compatible Versions (Match IPython 5.x)

This involves downgrading prompt-toolkit to the 1.x series that IPython 5.5.0 supports, and also downgrading jupyter-console to a version that works with prompt-toolkit 1.x:

# Uninstall the conflicting packages first
pip3 uninstall -y prompt-toolkit jupyter-console

# Install compatible versions
pip3 install prompt-toolkit==1.0.15 jupyter-console==5.2.0

After running these commands, restart your Jupyter Notebook and try opening the .ipynb file again. The kernel should connect successfully now.

Option 2: Upgrade IPython to Support prompt-toolkit 2.x

IPython 6.x and newer versions are designed to work with prompt-toolkit 2.x. Since you're using Python 3.6, the latest compatible IPython version is 7.16.1 (newer IPython versions drop support for Python 3.6). Run this command to upgrade:

pip3 install ipython==7.16.1

Once the upgrade finishes, restart Jupyter Notebook—your kernel should start without the import error.

Verify the Fix

After applying either option, you can double-check that your versions are compatible with these commands:

# Check IPython version
ipython --version

# Check prompt-toolkit version
pip3 show prompt-toolkit

Make sure:

  • If you went with Option 1: IPython 5.5.0 + prompt-toolkit 1.0.15
  • If you went with Option 2: IPython 7.16.1 + prompt-toolkit 2.0.9 (or another 2.x version within jupyter-console's required range)

内容的提问来源于stack exchange,提问作者Amin Merati

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:29:24