rasa
rasa copied to clipboard
Rasa Docker Image throwing error accessing mysql tracker store
Rasa Open Source version
rasa/rasa:3.2.2-full docker image
Rasa SDK version
No response
Python version
Other
What operating system are you using?
Linux
What happened?
When trying to use mysql as my tracker store in a docker-compose cluster, I get the following error:
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:MySQL
Command / Request
Here is my tracker store configuration in endpoints.yml:
tracker_store:
type: SQL
dialect: "MySQL" # the dialect used to interact with the db
url: "db" # (optional) host of the sql db, e.g. "localhost"
db: "rasa.db" # path to your db
username: "user" # username used for authentication
password: "pass"
Relevant log output
Experienced exception while trying to serve
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/sanic/app.py", line 1204, in run
serve_single(server_settings)
File "/opt/venv/lib/python3.8/site-packages/sanic/server/runners.py", line 206, in serve_single
serve(**server_settings)
File "/opt/venv/lib/python3.8/site-packages/sanic/server/runners.py", line 130, in serve
loop.run_until_complete(app._server_event("init", "before"))
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/opt/venv/lib/python3.8/site-packages/sanic/app.py", line 2000, in _server_event
await self.dispatch(
File "/opt/venv/lib/python3.8/site-packages/sanic/signals.py", line 191, in dispatch
return await dispatch
File "/opt/venv/lib/python3.8/site-packages/sanic/signals.py", line 161, in _dispatch
retval = await maybe_coroutine
File "/opt/venv/lib/python3.8/site-packages/sanic/app.py", line 1524, in _listener
await maybe_coro
File "/opt/venv/lib/python3.8/site-packages/rasa/core/run.py", line 247, in load_agent_on_start
app.ctx.agent = await agent.load_agent(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 225, in load_agent
tracker_store = TrackerStore.create(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/tracker_store.py", line 165, in create
tracker_store = _create_from_endpoint_config(obj, domain, event_broker)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/tracker_store.py", line 1315, in _create_from_endpoint_config
tracker_store = SQLTrackerStore(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/tracker_store.py", line 915, in __init__
self.engine = sa.create_engine(engine_url, **create_engine_kwargs(engine_url))
File "<string>", line 2, in create_engine
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
return fn(*args, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 534, in create_engine
entrypoint = u._get_entrypoint()
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/engine/url.py", line 655, in _get_entrypoint
cls = registry.load(name)
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 343, in load
raise exc.NoSuchModuleError(
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:MySQL
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 110, in main
cmdline_arguments.func(cmdline_arguments)
File "/opt/venv/lib/python3.8/site-packages/rasa/cli/run.py", line 126, in run
rasa.run(**vars(args))
File "/opt/venv/lib/python3.8/site-packages/rasa/api.py", line 56, in run
rasa.core.run.serve_application(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/run.py", line 225, in serve_application
app.run(
File "/opt/venv/lib/python3.8/site-packages/sanic/app.py", line 1204, in run
serve_single(server_settings)
File "/opt/venv/lib/python3.8/site-packages/sanic/server/runners.py", line 206, in serve_single
serve(**server_settings)
File "/opt/venv/lib/python3.8/site-packages/sanic/server/runners.py", line 130, in serve
loop.run_until_complete(app._server_event("init", "before"))
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/opt/venv/lib/python3.8/site-packages/sanic/app.py", line 2000, in _server_event
await self.dispatch(
File "/opt/venv/lib/python3.8/site-packages/sanic/signals.py", line 191, in dispatch
return await dispatch
File "/opt/venv/lib/python3.8/site-packages/sanic/signals.py", line 161, in _dispatch
retval = await maybe_coroutine
File "/opt/venv/lib/python3.8/site-packages/sanic/app.py", line 1524, in _listener
await maybe_coro
File "/opt/venv/lib/python3.8/site-packages/rasa/core/run.py", line 247, in load_agent_on_start
app.ctx.agent = await agent.load_agent(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 225, in load_agent
tracker_store = TrackerStore.create(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/tracker_store.py", line 165, in create
tracker_store = _create_from_endpoint_config(obj, domain, event_broker)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/tracker_store.py", line 1315, in _create_from_endpoint_config
tracker_store = SQLTrackerStore(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/tracker_store.py", line 915, in __init__
self.engine = sa.create_engine(engine_url, **create_engine_kwargs(engine_url))
File "<string>", line 2, in create_engine
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
return fn(*args, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 534, in create_engine
entrypoint = u._get_entrypoint()
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/engine/url.py", line 655, in _get_entrypoint
cls = registry.load(name)
File "/opt/venv/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 343, in load
raise exc.NoSuchModuleError(
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:MySQL
@skier233 In order for me to replicate this issue, can you please, if possible share your docker-compose file?
Sure. Here is my docker compose file:
version: '3.4'
services:
db:
image: mysql
volumes:
- "./.data/db:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mydb
MYSQL_USER: user
MYSQL_PASSWORD: pass
ports:
- 42333:3306
restbotserver:
depends_on:
- db
image: ${DOCKER_REGISTRY-}restbotserver
build:
context: .
dockerfile: restbotserver/Dockerfile
ports:
- 5278:80
- 7278:443
expose:
- 80
- 443
rasa:
image: rasa/rasa:3.2.2-full
volumes:
- ./RasaServer/:/app
command:
- run
expose:
- 5005
@skier233 In order for me to replicate this issue, can you please, if possible share your docker-compose file?
Sorry. forgot to tag you in my last reply.
@sanchariGr Any ideas on this?
@sanchariGr Any ideas on this?
@skier233 I tried reproducing the issue with the given docker-compose, without ofcourse the restbotserver
bits and couldn't replicate the issue you reported. I am afraid i will need more data from you.
Can you post a minimum reproducible example of your bot? The easiest way is to share a public repo of your bot [not the whole thing, just a small version that reproduces the behaviour you're reporting], which anyone who wants to look into the issue can clone and run to reproduce the behaviour.
Here's a github repo that can repro: https://github.com/skier233/RasaExampleError
@skier233 thanks for the reproducible repo, and i did encounter the error that you mentioned. Unfortunately mysql is not in the list of compatible databases for rasa so if you want this setup to work you would have to extend the rasa image to include mysql. Theres an example here on how to do that with Oracle.
@sanchariGr , would it be possible to add MySQL support in an upcoming version? The mentioned solution is not a very good option in my case because I plan to have my users running the rasa server on their computers through a docker compose cluster. Therefore, if I made my own expanded rasa image, I would have to host that image somewhere for my users to access and if I host it in the docker open registry, it could be confusing with the official rasa image, but, more importantly, every rasa update means I'd have to update my expanded image as well.
@skier233 apologies for the delay in replying, we have add this as a request in our backlog and will triage it. Alternatively if you would like to contribute this feature to rasa, that would also be highly appreciated:)