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

Update rasa-sdk dependencies to align with those of rasa #592

Closed
3 tasks
ancalita opened this issue Nov 12, 2021 · 8 comments
Closed
3 tasks

Update rasa-sdk dependencies to align with those of rasa #592

ancalita opened this issue Nov 12, 2021 · 8 comments
Labels
area:rasa-sdk 🧑‍💻 Everything that touches our python Rasa SDK effort:enable-squad/2 Label which is used by the Rasa Enable squad to do internal estimation of task sizes. type:dependencies Pull requests that update a dependency file type:maintenance 🔧 Improvements to tooling, testing, deployments, infrastructure, code style.

Comments

@ancalita
Copy link
Member

ancalita commented Nov 12, 2021

Description of Problem:

Installing editable version of rasa-sdk after having installed editable version of rasa in the same venv causes the bot to crash when running rasa shell, full stack trace below:

Bot loaded. Type a message and press enter (use '/stop' to exit): 
2021-11-11 13:26:28 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished name='Task-6' coro=<SignalRouter._dispatch() done, defined at /Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/signals.py:102> exception=RuntimeError('this event loop is already running.') created at /Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/signals.py:165>
source_traceback: Object created at (most recent call last):
  File "/Users/ancalita/rasa-projects/rasa-oss-09/bin/rasa", line 5, in <module>
    main()
  File "/Users/ancalita/rasa-projects/rasa/rasa/__main__.py", line 121, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/Users/ancalita/rasa-projects/rasa/rasa/cli/shell.py", line 125, in shell
    rasa.cli.run.run(args)
  File "/Users/ancalita/rasa-projects/rasa/rasa/cli/run.py", line 126, in run
    rasa.run(**vars(args))
  File "/Users/ancalita/rasa-projects/rasa/rasa/api.py", line 56, in run
    rasa.core.run.serve_application(
  File "/Users/ancalita/rasa-projects/rasa/rasa/core/run.py", line 221, in serve_application
    app.run(
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/app.py", line 1051, in run
    serve_single(server_settings)
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/server/runners.py", line 199, in serve_single
    serve(**server_settings)
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/server/runners.py", line 146, in serve
    loop.run_until_complete(app._server_event("init", "after"))
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/app.py", line 1496, in _server_event
    await self.dispatch(
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/signals.py", line 163, in dispatch
    return await dispatch
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/signals.py", line 133, in _dispatch
    retval = await maybe_coroutine
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/app.py", line 1382, in _listener
    await maybe_coro
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/app.py", line 1368, in dispatch_delayed_tasks
    await app.dispatch(name, context={"app": app, "loop": loop})
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/signals.py", line 165, in dispatch
    task = asyncio.get_running_loop().create_task(dispatch)
Traceback (most recent call last):
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/signals.py", line 133, in _dispatch
    retval = await maybe_coroutine
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/sanic/app.py", line 1374, in run_delayed_task
    await prepped
  File "/Users/ancalita/rasa-projects/rasa/rasa/core/run.py", line 134, in run_cmdline_io
    await console.record_messages(
  File "/Users/ancalita/rasa-projects/rasa/rasa/core/channels/console.py", line 175, in record_messages
    text = _get_user_input(previous_response)
  File "/Users/ancalita/rasa-projects/rasa/rasa/core/channels/console.py", line 108, in _get_user_input
    response = questionary.text(
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/questionary/question.py", line 50, in ask
    return self.unsafe_ask(patch_stdout)
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/questionary/question.py", line 64, in unsafe_ask
    return self.application.run()
  File "/Users/ancalita/rasa-projects/rasa-oss-09/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 890, in run
    return loop.run_until_complete(
  File "uvloop/loop.pyx", line 1450, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1443, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1351, in uvloop.loop.Loop.run_forever
  File "uvloop/loop.pyx", line 480, in uvloop.loop.Loop._run

This forum thread seems to pin the cause of this issue to the version of questionary which I noticed rasa-sdk downgrades from 1.10 to 1.8 when running make install.

Definition of Done:

  • questionary version in rasa-sdk is pinned to the higher version as in rasa-oss
  • double-check all dependencies are pinned to the higher version pinned in rasa-oss
  • you are able to run rasa shell without issues when both projects are installed as editable in the same venv
@ancalita ancalita added type:dependencies Pull requests that update a dependency file area:rasa-sdk 🧑‍💻 Everything that touches our python Rasa SDK type:maintenance 🔧 Improvements to tooling, testing, deployments, infrastructure, code style. labels Nov 12, 2021
@TyDunn TyDunn added the effort:enable-squad/2 Label which is used by the Rasa Enable squad to do internal estimation of task sizes. label Dec 17, 2021
@carlad
Copy link
Contributor

carlad commented Jan 6, 2022

I'm unable to replicate this issue after following the steps provided in the same virtualenv:

  • make install rasa
  • make install rasa-sdk
  • rasa init a new project
  • rasa shell
    I'm wondering if this is still an issue and which version of python you were using @ancalita.

@ancalita
Copy link
Member Author

@carlad So sorry, just saw your q on Python version, I was using python 3.8.6.
Related to the dependencies' diff: are you comparing 3.0.x or 2.8.x?

@carlad
Copy link
Contributor

carlad commented Jan 10, 2022

@ancalita

Related to the dependencies' diff: are you comparing 3.0.x or 2.8.x?

I'm doing both, though it seems the dependencies are similar...

carlad added a commit that referenced this issue Jan 18, 2022
* Update documentation workflow to only publish one version per major

* remove python classifiers from pyproject.toml

* bump development status classifier

* prepared release of version 3.0.2

* Fix a changelog entry

* comform toml to rasa 3.0.x

* use black 21.7b0

* pin requests to ^2.23

* support python 3.9

Co-authored-by: tczekajlo <t.czekajlo@rasa.com>
Co-authored-by: m-vdb <m.verger@rasa.com>
@ancalita
Copy link
Member Author

@carlad I'm seeing this issue again just now in a fresh venv with rasa and rasa-sdk installed via make install 🙈
questionary is version 1.10, and the project I'm using has a custom action defined and runs the actions server in a separate tab too.
When you have some time, could you please check with a similar project to see if rasa shell crashes for you too?

(oss-0122) ➜  required_slots_formvalidationaction rasa shell
2022-01-24 16:19:36 INFO     root  - Connecting to channel 'cmdline' which was specified by the '--connector' argument. Any other channels will be ignored. To connect to all given channels, omit the '--connector' argument.
2022-01-24 16:19:36 INFO     root  - Starting Rasa server on http://0.0.0.0:5005
2022-01-24 16:19:37 INFO     rasa.core.processor  - Loading model models/20220124-161441-humid-duplet.tar.gz...
2022-01-24 16:19:50 WARNING  rasa.shared.utils.common  - The UnexpecTED Intent Policy is currently experimental and might change or be removed in the future 🔬 Please share your feedback on it in the forum (https://forum.rasa.com) to help us make this feature ready for production.
2022-01-24 16:19:56 INFO     root  - Rasa server is up and running.
Bot loaded. Type a message and press enter (use '/stop' to exit): 
2022-01-24 16:19:57 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished name='Task-6' coro=<SignalRouter._dispatch() done, defined at /Users/ancalita/rasa-projects/oss-0122/lib/python3.8/site-packages/sanic/signals.py:102> exception=RuntimeError('this event loop is already running.')>
Traceback (most recent call last):
  File "/Users/ancalita/rasa-projects/oss-0122/lib/python3.8/site-packages/sanic/signals.py", line 133, in _dispatch
    retval = await maybe_coroutine
  File "/Users/ancalita/rasa-projects/oss-0122/lib/python3.8/site-packages/sanic/app.py", line 1374, in run_delayed_task
    await prepped
  File "/Users/ancalita/rasa-projects/rasa/rasa/core/run.py", line 134, in run_cmdline_io
    await console.record_messages(
  File "/Users/ancalita/rasa-projects/rasa/rasa/core/channels/console.py", line 175, in record_messages
    text = _get_user_input(previous_response)
  File "/Users/ancalita/rasa-projects/rasa/rasa/core/channels/console.py", line 108, in _get_user_input
    response = questionary.text(
  File "/Users/ancalita/rasa-projects/oss-0122/lib/python3.8/site-packages/questionary/question.py", line 70, in ask
    return self.unsafe_ask(patch_stdout)
  File "/Users/ancalita/rasa-projects/oss-0122/lib/python3.8/site-packages/questionary/question.py", line 92, in unsafe_ask
    return self.application.run()
  File "/Users/ancalita/rasa-projects/oss-0122/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 890, in run
    return loop.run_until_complete(
  File "uvloop/loop.pyx", line 1450, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1443, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1351, in uvloop.loop.Loop.run_forever
  File "uvloop/loop.pyx", line 480, in uvloop.loop.Loop._run
RuntimeError: this event loop is already running.

@ancalita
Copy link
Member Author

Could it be related to this issue: RasaHQ/rasa#10632?

@carlad
Copy link
Contributor

carlad commented Jan 26, 2022

So, without make installing anything, I wasn't able to replicate this working inside rasa-x-demo directory.
I was able to run rasa shell with no issues on either a rasa 2.8.x or 3.0.x virtualenv.

Rasa Version      :         2.8.15
Minimum Compatible Version: 2.8.9
Rasa SDK Version  :         2.8.2
Rasa X Version    :         1.0.1
Python Version    :         3.7.12

With rasa 3.0.x I'm also able to execute rasa shell ok.

Rasa Version      :         3.0.0
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.0.3
Rasa X Version    :         1.0.1
Python Version    :         3.8.6

However

After I ran make install in the rasa-sdk directory (following Anca's flow).
And then running rasa shell in rasa-x-demo I saw similar issues on 2.8.x and 3.0.x

At first I thought it was the questionary library version. There were several posts online from last year stating a rollback to v1.4.x fixed the issue. But after trying different questionary versions, settling finally on v1.8.1, I noticed that any time I ran make install in the rasa directory last, then ran rasa shell, it would launch fine. But anytime I ran make install in the rasa-sdk directory, then ran rasa shell, it would produce this error.

I've since updated questionary to v1.10.0 (i.e. using what is currently specified in the released projects) and the same behaviour happens.

So I'm thinking it's not about dependency conflicts, but about a loop process in the rasa-sdk make install task that doesn't end/close properly, but somehow gets reset when rasa is make installed .

@carlad
Copy link
Contributor

carlad commented Jan 28, 2022

So it turns out the issue was with the version of prompt-toolkit we were installing. Previously we had the version tied to '^2.0' in the .toml file, but I must have changed it to a range, which ended up installing the latest version (3.something).
Rolling back to '^2.0' solves the problem.

@carlad
Copy link
Contributor

carlad commented Jan 31, 2022

@carlad carlad closed this as completed Jan 31, 2022
@carlad carlad removed their assignment Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-sdk 🧑‍💻 Everything that touches our python Rasa SDK effort:enable-squad/2 Label which is used by the Rasa Enable squad to do internal estimation of task sizes. type:dependencies Pull requests that update a dependency file type:maintenance 🔧 Improvements to tooling, testing, deployments, infrastructure, code style.
Projects
None yet
Development

No branches or pull requests

3 participants