Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter-console incompatible with prompt-toolkit 2.0.2 #158

Closed
blfuentes opened this issue Jun 8, 2018 · 66 comments
Closed

Jupyter-console incompatible with prompt-toolkit 2.0.2 #158

blfuentes opened this issue Jun 8, 2018 · 66 comments

Comments

@blfuentes
Copy link

blfuentes commented Jun 8, 2018

After updating the prompt-toolkit package to the version 2.0.2 I get the following error message :

jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 2.0.2 which is incompatible.

Then if I start a jupyter notebook the message "kernel died" is appearing all the time with this output

[I 14:23:58.331 NotebookApp] Kernel started: 60ff14ae-6730-43b2-9c9a-5df4b549aa03
Traceback (most recent call last):
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\IPython\__init__.py", line 55, in <module>
    from .terminal.embed import embed
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\IPython\terminal\embed.py", line 16, in <module>
    from IPython.terminal.interactiveshell import TerminalInteractiveShell
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\IPython\terminal\interactiveshell.py", line 22, in <module>
    from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output
ImportError: cannot import name 'create_prompt_application'
[I 14:24:01.294 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports

I downgraded the prompt-toolkit to the version 1.0.15 and jupyter worked again.

Python 3.6.5
jupyter 1.0.0
jupyter-client 5.2.3
jupyter-console 5.2.0
jupyter-core 4.4.0
ipython 6.4.0

@homofortis
Copy link

+1

@yanshen0
Copy link

Same issue here. Hope it can be fixed soon.

@Carreau
Copy link
Member

Carreau commented Jun 13, 2018

Jupyter console needs some love. Most of the same work has been done in ipython/ipython#11177, if any of you have the time, feel free to send PRs.

@bofeiw
Copy link

bofeiw commented Jun 20, 2018

Same issue

@ldmtwo
Copy link

ldmtwo commented Jun 30, 2018

Oddly, it was working fine for a few weeks and suddenly today after rebooting, I got that same error. @blfuentes 's temporary solution worked perfectly. This is the command:

sudo pip install 'prompt-toolkit==1.0.15'

@JBlaschke
Copy link

JBlaschke commented Jul 7, 2018

Same here.. And it seems to be interfering with my jupyter notebook (via ipython)

@petasis
Copy link

petasis commented Jul 9, 2018

When will this be fixed? Its been more than one month that this bug prevents jupyter from running.

@takluyver
Copy link
Member

When someone gets to it. You can continue using Jupyter with prompt_toolkit 1.0.x in the meantime, so it's not high priority.

@Carreau
Copy link
Member

Carreau commented Jul 9, 2018

When someone gets to it. You can continue using Jupyter with prompt_toolkit 1.0.x in the meantime, so it's not high priority.

More especially, this is an open source project that is mostly developed by volunteers on their own time, which is one of resource we miss most.
The best way to get this issue fixed is to try to create a patch and send a pull request yourself. We are happy to guide you and review your work. As said above similar work has been done on IPython (ipython/ipython#11177) so transposing the work should not be too hard.

You can also help us by contributing to the project in other way (PR reviews, documentation, managing mailing list, social media, responding to other issues) which should free up time for more knowledgeable people to take care of complex issues.

Thanks

@petasis
Copy link

petasis commented Jul 14, 2018

Ok, I see. It is not a hi-priority, and this is a volunteer project. You assume that everybody knows python, knows how to hack jupyter code (and provide patches), and that the operating system is not pushing any updates.

@dsblank
Copy link
Member

dsblank commented Sep 16, 2018

Need to coordinate the release of a new jupyter-console with ipython, otherwise they each want different versions of prompt_toolkit.

If this is still an open issue, I'll port jupyter_console to prompt-toolkit later today.

@Carreau
Copy link
Member

Carreau commented Sep 16, 2018

@dsblank someone made #161, it just needs review/testing. It's on our todo list, but I'd like to release IPython 7.0 and IPykernel 5.0 first (who use PTK 2.0 as well).

@dsblank
Copy link
Member

dsblank commented Sep 16, 2018

Ok, cool! I made a couple of comments over there. I see why you want these released first... dependencies!

@dsblank
Copy link
Member

dsblank commented Sep 16, 2018

And that isn't just "someone"... that's @s-weigand !

@jiapei100
Copy link

Same here... Do NOT want to downgrade...

@edesz
Copy link

edesz commented Sep 27, 2018

I think I am getting a different flavor of this problem.

First attempt to install jupyterlab
Based on this post, I pin the version of prompt_toolkit in my requirements.txt

prompt_toolkit==1.0.15
jupyter
jupyterlab

But when I run

pip install -r requirements.txt

I get the following

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.33, 0.33, 0.34, 0.34, 0.35, 0.35, 0.36, 0.36, 0.37, 0.37, 0.38, 0.38, 0.39, 0.39, 0.40, 0.40, 0.41, 0.41, 0.42, 0.42, 0.43, 0.43, 0.44, 0.44, 0.45, 0.45, 0.46, 0.46, 0.47, 0.47, 0.48, 0.48, 0.49, 0.49, 0.50, 0.50, 0.51, 0.51, 0.52, 0.52, 0.53, 0.53, 0.54, 0.54, 0.55, 0.55, 0.56, 0.56, 0.57, 0.57, 0.58, 0.58, 0.59, 0.59, 0.60, 0.60, 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.0.2, 1.0.2, 1.0.3, 1.0.3, 1.0.4, 1.0.4, 1.0.5, 1.0.5, 1.0.6, 1.0.6, 1.0.7, 1.0.7, 1.0.8, 1.0.8, 1.0.9, 1.0.9, 1.0.10, 1.0.10, 1.0.13, 1.0.13, 1.0.14, 1.0.14, 1.0.15, 1.0.15, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.3, 2.0.3, 2.0.4, 2.0.4 There are incompatible versions in the resolved dependencies.

Second attempt to install jupyterlab
When I don't specify prompt_toolkit in requirements.txt

jupyter
jupyterlab

I get this

Could not find a version that matches prompt-toolkit<2.0.0,<2.1.0,>=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.33, 0.33, 0.34, 0.34, 0.35, 0.35, 0.36, 0.36, 0.37, 0.37, 0.38, 0.38, 0.39, 0.39, 0.40, 0.40, 0.41, 0.41, 0.42, 0.42, 0.43, 0.43, 0.44, 0.44, 0.45, 0.45, 0.46, 0.46, 0.47, 0.47, 0.48, 0.48, 0.49, 0.49, 0.50, 0.50, 0.51, 0.51, 0.52, 0.52, 0.53, 0.53, 0.54, 0.54, 0.55, 0.55, 0.56, 0.56, 0.57, 0.57, 0.58, 0.58, 0.59, 0.59, 0.60, 0.60, 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.0.2, 1.0.2, 1.0.3, 1.0.3, 1.0.4, 1.0.4, 1.0.5, 1.0.5, 1.0.6, 1.0.6, 1.0.7, 1.0.7, 1.0.8, 1.0.8, 1.0.9, 1.0.9, 1.0.10, 1.0.10, 1.0.13, 1.0.13, 1.0.14, 1.0.14, 1.0.15, 1.0.15, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.3, 2.0.3, 2.0.4, 2.0.4 There are incompatible versions in the resolved dependencies.

System Specifications

python 3.7.0
pip ---> latest

@Carreau
Copy link
Member

Carreau commented Sep 27, 2018

I just release IPython 7.0 that does support prompt_toolkit 2, now we can review the linked PR, merge it and deployed a new version of QtConsole.

There are just a dependencies between tasks that need to be taken care of... Help welcome in particular any task 9+ in this list still need someone to check manually that it has been done:

https://ipython.readthedocs.io/en/stable/coredev/index.html#update-milestones-on-github

@astrojuanlu
Copy link

@Carreau regarding your first comment in the issue: I thank all the voluntary effort that you do across the Jupyter ecosystem, and acknowledge that Jupyter devs get lots of undeserved whining from impatient users (I saw another thread where someone was using <h1> to make a point, really bad).

However, "feel free to send PRs" not only is hardly a useful explanation of what exactly needs to be done to port jupyter_console to prompt_toolkit 2.0: it also deviates the attention from the main user-facing issue, which is that people get broken installations.

jupyter_console is a package that most users do not use directly, but it gets installed when people do pip install jupyter when in fact they might just want pip install notebook. As pip does not solve dependencies (although at least now we get more informative warnings) this has the unfortunate consequence of dragging prompt-toolkit < 2 and therefore break both the notebook and ipython itself. As a result, even jupyter console itself is broken:

$ jupyter console
Traceback (most recent call last):
  File "/home/juanlu/.miniconda36/envs/propan36/bin/jupyter-console", line 7, in <module>
    from jupyter_console.app import main
  File "/home/juanlu/.miniconda36/envs/propan36/lib/python3.6/site-packages/jupyter_console/app.py", line 26, in <module>
    from jupyter_console.ptshell import ZMQTerminalInteractiveShell
  File "/home/juanlu/.miniconda36/envs/propan36/lib/python3.6/site-packages/jupyter_console/ptshell.py", line 21, in <module>
    from IPython.core import page
  File "/home/juanlu/.miniconda36/envs/propan36/lib/python3.6/site-packages/IPython/__init__.py", line 55, in <module>
    from .terminal.embed import embed
  File "/home/juanlu/.miniconda36/envs/propan36/lib/python3.6/site-packages/IPython/terminal/embed.py", line 16, in <module>
    from IPython.terminal.interactiveshell import TerminalInteractiveShell
  File "/home/juanlu/.miniconda36/envs/propan36/lib/python3.6/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'

In my opinion "jupyter_console is incompatible with IPython 7 at the moment because it's not yet ported to prompt-toolkit 2, please upgrade prompt-toolkit and you will be able to safely use IPython and Jupyter Notebook (at the cost of breaking jupyter_console) while someone does the port." would have been a much more useful comment. Even a hotfix of the jupyter metapackage restricting the versions would be a better temporary solution to this problem:

https://github.com/jupyter/jupyter/blob/563951c60d66118a79fa397efb410280f3ce4db7/setup.py#L26-L33

(See also #166)

Please take this as constructive criticism, I love what you folks are doing and hope that you continue to enrich this wonderful project <3

@Carreau
Copy link
Member

Carreau commented Sep 29, 2018

@Juanlu001, thanks for the constructive criticism, I'll take it into account.

I just want to no that this issue was open before IPython 7 was released, and it was unknown (at the time) how we would handle the transition.

It is often also relatively hard to balance giving the right amount of information.
A couple of years ago, it was pointed out to me that I was responding too fast, with too many intimate details, without letting a chance for other to step in. I may have dialed back a bit too much, plus me getting busy on other stuff.

In general, many project are highly under-maintained in Jupyter, and we may even miss that some people have contributed a lot, and should have received more permission on repo/gotten commit right, or recognition. I have some names in mind, but don't want to say anything without consulting the rest of the team.

When this is the case, please feel free to remind us of so like @Juanlu001 did, and we'll tust the community and try to foster collaboration.

Would anyone be willing to send a PR similar to this one from IPython to this repo, in order to allow anyone the ability to label and close issue, so that there is less bottleneck on the core devs ?

Thanks !

casey-bowman added a commit to exercises-crb/pb-exercises that referenced this issue Sep 29, 2018
When doing a fresh setup of pb-exercises, I’m seeing a problem with jupyter. It isn’t able to print ‘hello world’. This appears to be related to an incompatibility of IPython 7.0.1 and jupyter-console which depend on different versions of prompt_toolkit 
See jupyter/jupyter_console#158
This is a temporary fix for the problem, which can be removed once the jupyter issue is resolved.
@panispani
Copy link

Can someone explain how we can run Jupyter if we are willing to downgrade?
Downgrading with
pip3 install 'prompt-toolkit<2.0.0,>=1.0.0'
gives the 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.
While upgrading with
pip3 install 'prompt-toolkit<2.1.0,>=2.0.0'
gives the error
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.
Thanks

liudongqing added a commit to liudongqing/FeatureHub that referenced this issue Nov 5, 2018
There is a conflict of versions for dependency 'prompt-toolkit', see HDI-Project#12 and jupyter/jupyter_console#158. To resolve it, I tried to specify the versions of ipython & jupyter-console.
@MXWXZ
Copy link

MXWXZ commented Nov 12, 2018

pip3 install --upgrade --user ipython

This works for me in Ubuntu 18.04.

@ngocketit
Copy link

You also may need to do this: pip3 install --upgrade --user jupyter-console

@Abdelrahman995
Copy link

@ldmtwo worked for me thanks !

@samra-irshad
Copy link

@artgoldberg thanks, it worked!

@vedal
Copy link

vedal commented Feb 20, 2019

pip3 install --upgrade --force jupyter-console
Worked for me

@jbulow
Copy link

jbulow commented May 24, 2019

I have the same issue. Have read all comments here but still can't get rid of the error message. Using Ubuntu 18.04. Is there a known reproducible way to make it work on this OS?

@puramchendrasekhar1
Copy link

Oddly, it was working fine for a few weeks and suddenly today after rebooting, I got that same error. @blfuentes 's temporary solution worked perfectly. This is the command:

sudo pip install 'prompt-toolkit==1.0.15'

Thank you man, this worked for me

@Valuebai
Copy link

Valuebai commented Jul 7, 2019

pip3 install --upgrade --force jupyter-console
Worked for me
windows10 x64, the command worked for me too
pip install --upgrade --force jupyter-console

@AlexZettler
Copy link

If this hasn't been fixed yet, may I take my hand at working on a solution?

@Carreau
Copy link
Member

Carreau commented Aug 8, 2019

If this hasn't been fixed yet, may I take my hand at working on a solution?

Of course, and sorry if we can be slow to review. Feel free to ping us if necessary.

@sgillen
Copy link

sgillen commented Aug 13, 2019

sudo pip install 'prompt-toolkit==1.0.15'

worked just fine for me with no sudo too.

@October22
Copy link

The new version of prompt-toolkit(< 2.0) is 1.0.16(update Apr 12, 2019)

@robertlugg
Copy link

Hi future readers, per this:
https://medium.com/@supachaija/how-to-fixed-modulenotfounderror-prompt-toolkit-formatted-text-on-jupyter-python-b51f2132ac1c

Using this version works (I've also confirmed)
ipython==6.5.0

Presumably you are using an old version, but if you are just looking to get something running...

@tinmarino
Copy link
Contributor

pip3 install --upgrade --user jupyter worked for me installing:
installed prompt-toolkit-2.0.10
on Ubuntu 19.10 / Linux 5.3.0-24-generic

@Ransaka
Copy link

Ransaka commented May 2, 2020

Try pip install ipython --upgrade --user
this works for me;)

@Lena-MJ
Copy link

Lena-MJ commented Dec 30, 2020

pip3 install --upgrade --force jupyter-console
Worked for me
windows10 x64, the command worked for me too
pip install --upgrade --force jupyter-console

Also, worked for me, Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests