Start rasa x failed due to sqlalchemy.exc.OperationalError

I made a python virtualenv using python3.6. Then I installed rasa and rasa x: pip install rasa pip install rasa-x --extra-index-url Simple Index

environment: X64 linux centos7.9 Python 3.6.13

I run rasa init to initiate a new project and trained it. When I started rasa x in this project folder, I got a strange problem:

(rasax) [root@localhost rasaxtest]# rasa x Starting Rasa X in local mode… 0m Traceback (most recent call last): File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1800, in _execute_context cursor, statement, parameters, context File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/default.py”, line 717, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: near “WHERE”: syntax error

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasa/cli/x.py”, line 502, in run_locally domain_path=domain_path, File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasax/community/local.py”, line 234, in main sql_migrations.run_migrations(session) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasax/community/sql_migrations.py”, line 25, in run_migrations _run_schema_migrations(session) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasax/community/sql_migrations.py”, line 41, in _run_schema_migrations _run_alembic_migration(alembic_config) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasax/community/sql_migrations.py”, line 65, in _run_alembic_migration command.upgrade(alembic_config, target_revision) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/command.py”, line 298, in upgrade script.run_env() File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/script/base.py”, line 489, in run_env util.load_python_file(self.dir, “env.py”) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/util/pyfiles.py”, line 98, in load_python_file module = load_module_py(module_id, path) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/util/compat.py”, line 184, in load_module_py spec.loader.exec_module(module) File “”, line 678, in exec_module File “”, line 219, in _call_with_frames_removed File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/env.py”, line 96, in run_migrations_online() File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/env.py”, line 86, in run_migrations_online context.run_migrations() File “”, line 8, in run_migrations File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/runtime/environment.py”, line 846, in run_migrations self.get_context().run_migrations(**kw) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/runtime/migration.py”, line 522, in run_migrations step.migration_fn(**kw) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/versions/migration_2021_06_09_make_workspace_id_index_partial_30ec36905354.py”, line 39, in upgrade sqlite_where=sa.text(index_text), File “/root/py36/lib/python3.6/contextlib.py”, line 88, in exit next(self.gen) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/operations/base.py”, line 353, in batch_alter_table impl.flush() File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/operations/batch.py”, line 82, in flush fn(*arg, **kw) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/ddl/impl.py”, line 283, in create_index self._exec(schema.CreateIndex(index)) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/alembic/ddl/impl.py”, line 141, in _exec return conn.execute(construct, *multiparams, **params) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1286, in execute return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS) File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py”, line 78, in _execute_on_connection self, multiparams, params, execution_options File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1384, in _execute_ddl compiled, File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1843, in execute_context e, statement, parameters, cursor, context File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 2024, in handle_dbapi_exception sqlalchemy_exception, with_traceback=exc_info[2], from=e File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/util/compat.py”, line 207, in raise raise exception File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1800, in _execute_context cursor, statement, parameters, context File “/root/.virtualenvs/rasax/lib/python3.6/site-packages/sqlalchemy/engine/default.py”, line 717, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near “WHERE”: syntax error [SQL: CREATE INDEX msg_log_workspace_id_idx ON message_log (workspace_id) WHERE workspace_id is not NULL] (Background on this error at: Error Messages — SQLAlchemy 1.4 Documentation)

Sorry, something went wrong (see error above). Make sure to start Rasa X with valid data and valid domain and config files. Please, also check any warnings that popped up. If you need help fixing the issue visit our forum: http://forum.rasa.com/. ^CGoodbye Goodbye Exception ignored in: <Finalize object, dead> Traceback (most recent call last): File “/root/py36/lib/python3.6/multiprocessing/util.py”, line 186, in call File “/root/py36/lib/python3.6/multiprocessing/heap.py”, line 208, in free TypeError: ‘NoneType’ object is not callable Exception ignored in: <Finalize object, dead> Traceback (most recent call last): File “/root/py36/lib/python3.6/multiprocessing/util.py”, line 186, in call File “/root/py36/lib/python3.6/multiprocessing/heap.py”, line 208, in free TypeError: ‘NoneType’ object is not callable Exception ignored in: <Finalize object, dead> Traceback (most recent call last): File “/root/py36/lib/python3.6/multiprocessing/util.py”, line 186, in call File “/root/py36/lib/python3.6/multiprocessing/heap.py”, line 208, in free TypeError: ‘NoneType’ object is not callable Exception ignored in: <Finalize object, dead> Traceback (most recent call last): File “/root/py36/lib/python3.6/multiprocessing/util.py”, line 186, in call File “/root/py36/lib/python3.6/multiprocessing/heap.py”, line 208, in free TypeError: ‘NoneType’ object is not callable

@atptour Welcome to the forum :bouquet:

Can you share the rasa --version for us while activating the Conda based environment?

OR

Please follow these steps for the installation of ROS and Rasa X :slight_smile:

Note: You can ignore few steps, if you already performed it!

Please install Anaconda from Anaconda | Individual Edition , then create the conda environment using the following command

  1. conda create -n rasa3 python=3.8
  2. conda activate rasa 3

PS: If you using Linux, check the environment for the same.

Note: I’d recommend to create a fresh environment if not you can proceed with next steps:

For Rasa Open Source:

`pip install rasa==2.8.1`
`pip install rasa-sdk==2.8.1'

check version rasa --version its install or not

For Installing basic project:

rasa init

then if you need

For Rasa-X Installation

pip install rasa-x==0.39.3 --extra-index-url https://pypi.rasa.com/simple

check rasa version rasa --version its install or not

You will see some error : ImportError: cannot import name ‘RowProxy’ from ‘sqlalchemy.engine’ Install

pip install SQLAlchemy==1.3.22 should fix it

If sanic related error: pip install sanic-jwt==1.6.0

delete .db (events and rasa ) if is showing alembic issue.

If you have any error in-between please share with us.

Note: You will see the Event Loop Close error in the terminal, you can ignore that, its an persistent issue with Rasa X and team is working on it.

I hope this will solve your issue. Good Luck!

I tried rasa --version. The result is below. However I also tried reinstallation in Anaconda under your suggestion, it took too long time and has not finished yet. I will reply you after I finish.

(rasax) [root@localhost .cache]# rasa --version Rasa Version : 2.8.6 Minimum Compatible Version: 2.8.0 Rasa SDK Version : 2.8.2 Rasa X Version : None Python Version : 3.6.13 Operating System : Linux-3.10.0-1160.42.2.el7.x86_64-x86_64-with-centos-7.9.2009-Core Python Path : /root/.virtualenvs/rasax/bin/python

I follow your steps for installation of ROS and Rasa X, and I still failed to start Rasa X:

It was installed in conda with python3.8:

(rasa3) [root@localhost responseselectorbot]# rasa --version Rasa Version : 2.8.1 Minimum Compatible Version: 2.8.0 Rasa SDK Version : 2.8.1 Rasa X Version : 0.39.3 Python Version : 3.8.12 Operating System : Linux-3.10.0-1160.42.2.el7.x86_64-x86_64-with-glibc2.17 Python Path : /root/anaconda3/envs/rasa3/bin/python

The error of rasa x startup:

(rasa3) [root@localhost test]# rasa x Starting Rasa X in local mode… 0m Traceback (most recent call last): File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasa/cli/x.py”, line 496, in run_locally local.main( File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/local.py”, line 234, in main sql_migrations.run_migrations(session) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/sql_migrations.py”, line 25, in run_migrations _run_schema_migrations(session) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/sql_migrations.py”, line 41, in _run_schema_migrations _run_alembic_migration(alembic_config) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/sql_migrations.py”, line 65, in _run_alembic_migration command.upgrade(alembic_config, target_revision) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/command.py”, line 298, in upgrade script.run_env() File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/base.py”, line 489, in run_env util.load_python_file(self.dir, “env.py”) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/util/pyfiles.py”, line 98, in load_python_file module = load_module_py(module_id, path) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/util/compat.py”, line 184, in load_module_py spec.loader.exec_module(module) File “”, line 843, in exec_module File “”, line 219, in _call_with_frames_removed File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/database/schema_migrations/alembic/env.py”, line 96, in run_migrations_online() File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/database/schema_migrations/alembic/env.py”, line 86, in run_migrations_online context.run_migrations() File “”, line 8, in run_migrations File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/runtime/environment.py”, line 846, in run_migrations self.get_context().run_migrations(**kw) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/runtime/migration.py”, line 511, in run_migrations for step in self._migrations_fn(heads, self): File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/command.py”, line 287, in upgrade return script._upgrade_revs(revision, rev) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/base.py”, line 364, in _upgrade_revs revs = list(revs) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/revision.py”, line 777, in _iterate_revisions uppers = util.dedupe_tuple(self.get_revisions(upper)) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/revision.py”, line 321, in get_revisions resolved_id, branch_label = self.resolve_revision_number(id) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/revision.py”, line 501, in _resolve_revision_number self._revision_map File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/util/langhelpers.py”, line 230, in get obj.dict[self.name] = result = self.fget(obj) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/revision.py”, line 123, in _revision_map for revision in self._generator(): File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/base.py”, line 112, in _load_revisions script = Script.from_filename(self, vers, file) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/script/base.py”, line 906, in from_filename module = util.load_python_file(dir, filename) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/util/pyfiles.py”, line 98, in load_python_file module = load_module_py(module_id, path) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/alembic/util/compat.py”, line 184, in load_module_py spec.loader.exec_module(module) File “”, line 843, in exec_module File “”, line 219, in _call_with_frames_removed File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/database/schema_migrations/alembic/versions/migration_2019_06_03_initial_migration_2a216ed121dd.py”, line 14, in import rasax.community.database.schema_migrations.alembic.utils as migration_utils File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/database/schema_migrations/alembic/utils.py”, line 12, in from sqlalchemy.engine import reflection, RowProxy, Connection ImportError: cannot import name ‘RowProxy’ from ‘sqlalchemy.engine’ (/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/sqlalchemy/engine/init.py)

Sorry, something went wrong (see error above). Make sure to start Rasa X with valid data and valid domain and config files. Please, also check any warnings that popped up. If you need help fixing the issue visit our forum: http://forum.rasa.com/.

@atptour I hope you have seen and read my complete post, this error mention there.

For ‘RowProxy’ error:

Install

pip install SQLAlchemy==1.3.22

Do mention me with @ and nik202

Thanks! After installing sqlalchemy==1.3.22 I started rasa x and got the following loop event:

Is it the error you metioned in Note?

[2021-10-23 09:38:33 -0400] [5536] [ERROR] Exception occurred while handling uri: ‘http://localhost:5002/api/projects/default/models/tags/production?token=b1c19770ea89768fd18055ea74bcb388’ Traceback (most recent call last): File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/sanic/app.py”, line 908, in handle_request response = await self._run_request_middleware( File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/spf/framework.py”, line 646, in _run_request_middleware_19_12 response = await response File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/database/utils.py”, line 368, in set_session user = await decorators.user_from_request(request) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/api/decorators.py”, line 90, in user_from_request return await _get_user_from_request(request.app, request) File “/root/anaconda3/envs/rasa3/lib/python3.8/site-packages/rasax/community/api/decorators.py”, line 73, in _get_user_from_request payload = await instance.auth.extract_payload(request, verify=False) AttributeError: ‘Sanic’ object has no attribute ‘auth’

@atptour please install

pip install sanic-jwt==1.6.0

Thanks! It does work now. But I still have another quesiton: you mentioned that I need to install rasa and rasa-x with special version: 2.8.1 and so on. Could I install and use rasa and rasa-x with the latest version? Will the newest rasa-x version work well? Or if I could fix few problems will the newest rasa-x work?

I have tried this action, it took too long time to install all the packages and the whole installation procedure was always blocked by mutiple versions selection of pip. I have not finished the full installation yet up to now:

INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking INFO: pip is looking at multiple versions of sniffio to determine which version is compatible with other requirements. This could take a while.

@atptour Great, can I request too please close this thread with the solution for other readers and for your reference. If your installation taking a longer time,and If you are not able to install you can downgrade the pip version to 20.2.2 (conda install pip==20.2.2)

OK. Shall I close it or you? I have never operate closing topic in this forum. I have not found out the close button.