With a fresh install of Jupyter in a clean pipenv or virtualenv, a new notebook crashes immediately upon launch with the following in terminal:
[I 13:39:55.748 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/kat/Projects/jupyter_bug/ENV/lib/python3.7/site-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/Users/kat/Projects/jupyter_bug/ENV/lib/python3.7/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/Users/kat/Projects/jupyter_bug/ENV/lib/python3.7/site-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/Users/kat/Projects/jupyter_bug/ENV/lib/python3.7/site-packages/IPython/__init__.py", line 55, in <module>
from .terminal.embed import embed
File "/Users/kat/Projects/jupyter_bug/ENV/lib/python3.7/site-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/Users/kat/Projects/jupyter_bug/ENV/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 20, in <module>
from prompt_toolkit.formatted_text import PygmentsTokens
ModuleNotFoundError: No module named 'prompt_toolkit.formatted_text'
[W 13:39:58.759 NotebookApp] KernelRestarter: restart failed
[W 13:39:58.760 NotebookApp] Kernel d6c405e3-6b72-4be9-93fd-f44aecc78576 died, removing from map.
Originally seen on an Ubuntu 18.04 machine using Python 3.7 and recreated on Mac OS Sierra and High Sierra with 3.7, as well as Ubuntu 16.04 with 2.7 and then 3.6. Four separate machines.
This came up during installation and later resulted in the error mentioned by OP.
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
installing latest version of prompt-toolkit==2.0.4 resulted in
jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 2.0.4 which is incompatible
so it seems that ipython and jupyter-console have conflicting versions of prompt-toolkit as dependency.
installing with pipenv gives this error:
Adding jupyter to Pipfile's [packages]...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
Could not find a version that matches prompt-toolkit<2.0.0,<2.1.0,==1.0.15,>=1.0.0,>=2.0.0
Tried: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.25, 0.26, 0.28, 0.30, 0.31, 0.32, 0.32, 0.32, 0.33, 0.33, 0.33, 0.34, 0.34, 0.34, 0.35, 0.35, 0.35, 0.36, 0.36, 0.36, 0.37, 0.37, 0.37, 0.38, 0.38, 0.38, 0.39, 0.39, 0.39, 0.40, 0.40, 0.40, 0.41, 0.41, 0.41, 0.42, 0.42, 0.42, 0.43, 0.43, 0.43, 0.44, 0.44, 0.44, 0.45, 0.45, 0.45, 0.46, 0.46, 0.46, 0.47, 0.47, 0.47, 0.48, 0.48, 0.48, 0.49, 0.49, 0.49, 0.50, 0.50, 0.50, 0.51, 0.51, 0.51, 0.52, 0.52, 0.52, 0.53, 0.53, 0.53, 0.54, 0.54, 0.54, 0.55, 0.55, 0.55, 0.56, 0.56, 0.56, 0.57, 0.57, 0.57, 0.58, 0.58, 0.58, 0.59, 0.59, 0.59, 0.60, 0.60, 0.60, 1.0.0, 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.0.1, 1.0.2, 1.0.2, 1.0.2, 1.0.3, 1.0.3, 1.0.3, 1.0.4, 1.0.4, 1.0.4, 1.0.5, 1.0.5, 1.0.5, 1.0.6, 1.0.6, 1.0.6, 1.0.7, 1.0.7, 1.0.7, 1.0.8, 1.0.8, 1.0.8, 1.0.9, 1.0.9, 1.0.9, 1.0.10, 1.0.10, 1.0.10, 1.0.13, 1.0.13, 1.0.13, 1.0.14, 1.0.14, 1.0.14, 1.0.15, 1.0.15, 1.0.15, 2.0.1, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.2, 2.0.3, 2.0.3, 2.0.3, 2.0.4, 2.0.4, 2.0.4
There are incompatible versions in the resolved dependencies.
seems like it is being fixed here https://github.com/nengo/nengo-dl/commit/f71bcefe8cfdda755c4c9bb26dce9f7333a555eb
As a temporary workaround, this will fix it:
pip install 'ipykernel<5.0.0'
As a temporary workaround, this will fix it:
pip install 'ipykernel<5.0.0'
Have been trying to fix for hours.
Thank you,
pip install 'ipykernel<5.0.0'
It seem extremely unlikely this was the problem. IPykernel does not rely on prompt_toolkit, and IPykernel<5 with IPython>7 will still break jupyter.
For those of you who tried and for who this fixes things with version of IPython is now installed ?
The jupyter-console master also supports prompt-toolkit>2, so instead of downgrading ipython, upgrading jupyter-console should work als well (tested it in a fresh conda env after the ipython 7.0 release).
So the other temporary workaround (untill the next version of jupyter-console is on PyPi), that will fix it is:
pip install git+https://github.com/jupyter/jupyter_console
See jupyter_console #167, for updates on the release.
Sure, but I dont' think everyone should run for master.
It just make no sens that downgrading ipykernel fixes things. It must be a fluke.
The only change in files that trigger above error was a typo in a docstring.
pip install 'ipykernel<5.0.0'
This fixed the problem for me such that the Kernel would start and I could use my notebook.
As a temporary workaround, this will fix it:
pip install 'ipykernel<5.0.0'
Thank you, this fixed my problem also. I was able to open up notebooks but the cells would not run.
Using jupyter notebooks, if I just specify ipykernel with 'jupyter' as a requirement I still get this error:
jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 2.0.5 which is incompatible.
The minimal requirements.txt that gives me working notebook is:
ipykernel<5.0.0
notebook
pip figures it out from there.
If you add ipython
same error 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.
So you need ipython<7.0.0 as well if you have ipython specified.
I confirm below works for me at the moment (ipykernel<5.0.0 alone was not enough):
pip3 install jupyter 'ipykernel<5.0.0' 'ipython<7.0.0'
I have the same error as indicated above.
If I try pip install 'ipykernel<5.0.0' command in my command prompt of Windows 10, I get the following error
The system cannot find the file specified.
Please can you let this newbie know how to rectify this error?
since there is a new release of jupyter_console the following command should fix the problem if its allready there and if not it shouldn't appear anymore:
pip install -U jupyter_console
@KTM-300 does your system know about pip (does pip --version work)?
If not you can add the path of your python installation to the PATH variable.
Thanks for helping.
Yes, pip --version works.
I managed to get around the problem with the answer from https://stackoverflow.com/questions/52551878/problems-upgrading-ipython-prompt-toolkit-incompatibilities
Confirmed that pip install -U jupyter_console fixes this.
In particular, this problem started happening in my environment with prompt-toolkit-1.0.15. For what it's worth, my environment initially had prompt-toolkit-2.0.5, but then an install of py2neo into my environment forced a downgrade of prompt-toolkit to 1.0.15.
So, this may happen if the installation of a new package sneaks in a downgrade of prompt-toolkit down to 1.x.
You can try to upgrade jupyter-conslole 's version, then promblems are fixed.
As a temporary workaround, this will fix it:
pip install 'ipykernel<5.0.0'
Thank you so much!
Hi
pip install -U jupyter_console
helped me out.
pip install -U jupyter_console
+1
pip install -U jupyter_console
is working properly
As a temporary workaround, this will fix it:
pip install 'ipykernel<5.0.0'
Thank you so much, I almost took a day to solve this.
If I try
pip install 'ipykernel<5.0.0'command in my command prompt of Windows 10, I get the following errorThe system cannot find the file specified.
I had to replace the single quotes to double quotes to get the command to work:
pip install "ipykernel<5.0.0"
(From https://github.com/jupyter/notebook/issues/5024#issuecomment-646076083) Rather than _downgrade_ ipykernel and IPython, especially given the timeframe of those initial suggestions (which may have been correct at the time), I would first try ensuring that you're running the latest versions of each and _upgrade_ if not.
Also, since IPython appears to be sensitive to the version of prompt_toolkit, I would recommend checking prompt_toolkit's version as well.
If someone finds this "upgrade" approach successful, could you please add a comment? This will allow future incidents to be forward-moving rather than not. Thank you.
I confirm below works for me at the moment (
ipykernel<5.0.0alone was not enough):pip3 install jupyter 'ipykernel<5.0.0' 'ipython<7.0.0'
Thanks @gronki
conda install ipykernel'<5.0.0' ipython'<7.0.0' worked for me.
like you, just ipykernel'<5.0.0' wasn't enough.
@kevin-bates This worked for me indeed:
pip install prompt_toolkit --force-reinstall
Thanks!
pip install ipython==7 prompt-toolkit==2.0.10 jupyter-console==6.0.0
worked for me
pip install ipython==7 prompt-toolkit==2.0.10 jupyter-console==6.0.0
worked for me
This worked for me. Thanks!
pip install ipython==7 prompt-toolkit==2.0.10 jupyter-console==6.0.0
worked for me
Hey it's worked for me too. it's saved my day. thanks
conda update jupyter will also get compatible package versions for anyone using conda
And sometimes some package forces the old prompt_toolkit version on you, as is the case with wandb at the moment: https://github.com/wandb/client/issues/1498
If I try
pip install 'ipykernel<5.0.0'command in my command prompt of Windows 10, I get the following errorThe system cannot find the file specified.
I had to replace the single quotes to double quotes to get the command to work:
pip install "ipykernel<5.0.0"
Thanks a lot!
need to double quotes +1
pip install ipython==7 prompt-toolkit==2.0.10 jupyter-console==6.0.0
worked for me
Thank you very much~
It works!
Most helpful comment
As a temporary workaround, this will fix it:
pip install 'ipykernel<5.0.0'