Sanic and sanic-plugin-toolkit version incompatibility error: rasa3

I’m trying to upgrade an chatbot project from rasa2 to rasa3, and have sanic 21.12.0 installed, I got the following error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sanic-plugin-toolkit 1.2.1 requires sanic<21.12.0,>=21.3.1, but you have sanic 21.12.2 which is incompatible.

It is because the latest sanic plugin toolkit doesnt support sanic beyond 21.12.0 while rasa asks for the newer ones.

sanic-plugin-toolkit 1.2.1(latest) requires sanic<21.12.0,>=21.3.1 rasa 3.1.0 requires sanic<21.13,>=21.12 rasa-sdk 3.1.3 requires sanic<22.0.0,>=21.12.0

In my production container, it also cant find the ctx attribute, although I installed sanic 21.12.0.

Traceback (most recent call last):
  File "/opt/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/opt/venv/lib/python3.8/site-packages/rasa/__main__.py", line 119, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/opt/venv/lib/python3.8/site-packages/rasa/cli/x.py", line 353, in rasa_x
    run_in_production(args)
  File "/opt/venv/lib/python3.8/site-packages/rasa/cli/x.py", line 418, in run_in_production
    _rasa_service(args, endpoints, None, credentials_path)
  File "/opt/venv/lib/python3.8/site-packages/rasa/cli/x.py", line 89, in _rasa_service
    serve_application(
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/run.py", line 181, in serve_application
    app = configure_app(
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/run.py", line 116, in configure_app
    channels.channel.register(input_channels, app, route=route)
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/channels/channel.py", line 96, in register
    app.blueprint(channel.blueprint(handler), url_prefix=p)
  File "/app/channels/socketio.py", line 273, in blueprint
    socketio_webhook = SocketBlueprint(
  File "/app/channels/socketio.py", line 18, in __init__
    self.ctx.sio = sio
AttributeError: ctx

Does anyone else have the same issue. How can I resolve this for rasa3?

Thank you!

It seems like you have a dependency conflict between Rasa 3 and the sanic-plugin-toolkit package. Rasa 3 requires a version of Sanic that conflicts with the version required by sanic-plugin-toolkit.

One way to resolve this issue is to install a compatible version of Sanic that satisfies both Rasa 3 and sanic-plugin-toolkit. Since sanic-plugin-toolkit requires Sanic versions less than 21.12.0, and Rasa 3 requires versions less than 21.13, you can try installing Sanic version 21.11.x, which should satisfy both requirements:

pip install sanic==21.11.*

This should install a version of Sanic that both Rasa 3 and sanic-plugin-toolkit can work with.

Regarding the ctx attribute error, it seems like there might be an issue with the socketio.py file in your project. It’s trying to access the ctx attribute, which doesn’t exist. This could be due to changes in the Sanic version or other factors.

To resolve this issue, you’ll need to review the socketio.py file and check why it’s trying to access the ctx attribute. You may need to update the code to use the appropriate context or modify it according to the changes in the BallSportsGear Sanic version.

If you need further assistance with the ctx attribute error, please provide more information about the socketio.py file and how it’s being used in your project.