rasa-core uses older prompt_toolkit version

Created on 8 Oct 2018  Â·  19Comments  Â·  Source: RasaHQ/rasa

Rasa Core version:
rasa-core==0.11.11
Python version:
3.6.5
Operating system (windows, osx, ...):
Windows 10
Issue:

ipython 7.0.1 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.14 which is incompatible.

Most helpful comment

We currently have a fix for this in a master branch of Rasa Core so another alternative is to use that.

All 19 comments

Hmm, when does this happen? We don't actually have prompt-toolkit in the list of our requirements as far as i can tell

pyinquirer has dependency of prompt-toolkit

pyinquirer 1.0.2 has requirement prompt-toolkit==1.0.14, but you'll have prompt-toolkit 2.0.5 which is incompatible.
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.

@JustinaPetr any ideas?

Hmmm, yeah. Rasa Core installs prompt-toolkit 1.0.14 while ipython >=7.0.0 requires prompt-toolkit 2.0.5. and it's a breaking incompatibility for ipython. After installing rasa_core and then updating prompt-toolkit to 2.0.5 everything seems to work fine.

I couldn't reproduce the jupyter-console related issue, but since ipython 7.0.0 is a brand new release, I would suggest updating jupyter as well (jupyter-console 6.0.0 seems to work fine with prompt-toolkit 2.0.5).

Thanks @JustinaPetr @akelad worked for me!

It was alright until I found out this!

Traceback (most recent call last):
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\train.py", line 23, in <module>
    from rasa_core.training import online
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\training\online.py", line 14, in <module>
    from PyInquirer import prompt
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInquirer\__init__.py", line 6, in <module>
    from prompt_toolkit.token import Token
ImportError: cannot import name 'Token'

this happened whilst training:-
python -m rasa_core.train -d domain.yml -s stories.md -o models/dialogue

Got the same error for the same command. The issue with clashing dependency versions still persist.
See https://github.com/RasaHQ/rasa_core/blob/master/setup.py#L72

Anyone has an idea how to fix this issue or how to work around?
So far I was unable to wrap my head around it… working with:

rasa-core==0.11.12
rasa-core-sdk==0.11.5
rasa-nlu==0.13.7
prompt-toolkit==2.0.5
notebook==5.7.0
jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==6.0.0
jupyter-contrib-core==0.3.3
jupyter-core==4.4.0
jupyter-nbextensions-configurator==0.4.0
[…]

Any ideas?

@JustinaPetr can you take a look?

@akelad You should read this about PyInquirer 2 https://github.com/CITGuru/PyInquirer/releases/tag/1.0.3

This also make kernel of binder keep dying even launched from this repo. Any update on this?

@JustinaPetr

Ahh, I see what's going on now. Just like I mentioned in my first comment, ipython >=7.0.0 needs prompt-toolkit>=2.0.5 and if you use a lower version (for example 1.0.14 which gets installed with Rasa Core, the kernel crashes). Simply updating prompt-toolkit after installing rasa_core fixes the ipython issue, but if you train the model using the cmdline, then it crashes because interactive learning in rasa_core uses prompt-toolkit 1.0.14.

A little compromise that should help both - ipython and cmdline work is to downgrade the ipython to 6.5.0 (pip install ipython==6.5.0) which seems to work with prompt-toolkit 1.0.14. It's not ideal though as one or another might still break. I would say we should look into upgrading the interactive learning to run with prompt-toolkit 2.0.5

@JustinaPetr should we close this issue then since the other one supersedes it?

@akelad yes, sounds good.

It was alright until I found out this!

Traceback (most recent call last):
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\train.py", line 23, in <module>
    from rasa_core.training import online
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\training\online.py", line 14, in <module>
    from PyInquirer import prompt
  File "C:\Users\Rahul\AppData\Local\Programs\Python\Python36\lib\site-packages\PyInquirer\__init__.py", line 6, in <module>
    from prompt_toolkit.token import Token
ImportError: cannot import name 'Token'

I understand that this is closed. Just to drop a note to people who is looking for the answer to above problem.

To solve this problem, downgrade prompt-toolkit to 1.0.14. To check the current version of this module, do:

[root@your_lovely_server my_dir]# pip list | grep prompt-toolkit
prompt-toolkit      2.0.7

To install new version, do:

[root@your_lovely_server my_dir]# pip install prompt-toolkit==1.0.14

It works for me, hope it will work for you also.

Also your iPython should be of 6.5.0.
pip install ipython==6.5.0

We currently have a fix for this in a master branch of Rasa Core so another alternative is to use that.

Was this page helpful?
0 / 5 - 0 ratings