18

Trying to open a jupyter notebook file (.ipynb file) with this command ipython notebook filename.ipynb then I am getting Below Error while using ipython..

Traceback (most recent call last):
File "c:\python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python\Scripts\ipython.exe\__main__.py", line 5, in <module>
File "c:\python\lib\site-packages\IPython\__init__.py", line 55, in <module>
from .terminal.embed import embed
File "c:\python\lib\site-packages\IPython\terminal\embed.py", line 16, in 
<module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "c:\python\lib\site-packages\IPython\terminal\interactiveshell.py", 
line 18, in <module>
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
ModuleNotFoundError: No module named 'prompt_toolkit'
hpaulj
  • 221,503
  • 14
  • 230
  • 353
Chirag Rajpurohit
  • 181
  • 1
  • 1
  • 3
  • try install prompt toolkit `pip install prompt_toolkit` – ikuamike Sep 28 '18 at 09:15
  • Done and i got this message but the issue is not resolved -> Requirement already satisfied: prompt_toolkit in /home/chirag/miniconda3/lib/python3.7/site-packages (1.0.15) Requirement already satisfied: wcwidth in /home/chirag/miniconda3/lib/python3.7/site-packages (from prompt_toolkit) (0.1.7) Requirement already satisfied: six>=1.9.0 in /home/chirag/miniconda3/lib/python3.7/site-packages (from prompt_toolkit) (1.11.0) – Chirag Rajpurohit Sep 28 '18 at 09:20
  • This is a valid `ipython` error report. Others of us have encountered this. It should be reopened. But it's probably better reported as a ipython/jupyter bug. – hpaulj Sep 28 '18 at 19:08
  • A relevant bug issue: https://github.com/jupyter/jupyter/issues/370. There appears to be a conflict in dependencies in different parts of the jupyter install. We may have to wait a day or two for it to be straightened out. – hpaulj Sep 28 '18 at 19:22
  • For now I've got a cleaner install using `ipython==6.5` rather than the latest. – hpaulj Sep 28 '18 at 20:57
  • And https://github.com/ipython/ipython/issues/11341 – hpaulj Sep 28 '18 at 21:46

1 Answers1

43

Just got the same problem.

The solution for me was to pip uninstall prompt-toolkit and pip install prompt-toolkit. This uninstalled v1.0.5 and installed v2.0.4.

Vadim
  • 515
  • 1
  • 4
  • 9
  • 1
    It works for me. Thank you. I did `pipenv install prompt-toolkit==2.0.4`. – x112341 Sep 28 '18 at 14:20
  • I just encountered this problem as well when upgrading `jupyter`. Uninstalling the `prompt-toolkit`, and doing a clean install seemed to do the trick. But secondary indents aren't behaving quite right. – hpaulj Sep 28 '18 at 19:07
  • https://github.com/ipython/ipython/issues/11337 is the issue that I encountered with v7. I could only create one line function definitions. – hpaulj Sep 29 '18 at 06:50
  • 3
    Instead of uninstalling and removing, you can also just upgrade the package with `pip install --upgrade prompt-toolkit` – Alexandre D'Erman Apr 09 '19 at 17:51