Rasa X not loading models suddenly

Hi all,

Anyone that can help me resolve this issue as this goes over my head?

When trying to run Rasa X locally it won’t load any models, while it used to work previously. It does open Rasa X on the browser, but no models or previous conversations are loaded.

Error when running rasa x, running rasa shell works perfectly fine.

These are the versions of Rasa tools I am currently using:

Rasa Version      :         2.6.2
Minimum Compatible Version: 2.6.0
Rasa SDK Version  :         2.6.0
Rasa X Version    :         0.40.0
Python Version    :         3.8.0
Operating System  :         Windows-10-10.0.19041-SP0

I have tried the solution presented in “Rasa X failed to run”, although to no avail.

Below are the errors that occur when running rasa x.

> $ rasa x
> c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\shared\core\slots.py:311: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'requested_slot' instead.
>   rasa.shared.utils.io.raise_warning(
> Starting Rasa X in local mode... 🚀
> c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\utils\cli.py:84: UserWarning: Value to map 'vuller' is equal to the entity synonym's value.
> c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\utils\cli.py:84: UserWarning: Value to map 'dozenkeerder' is equal to the entity synonym's value.
> c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\utils\cli.py:84: UserWarning: At least one value to map must be specified.
> 2021-10-31 14:51:18 WARNING  rasax.community.services.insights.insight_service  - No local evaluation result files found.
> 2021-10-31 14:51:20 ERROR    concurrent.futures  - exception calling callback for <Future at 0x11ccffb0430 state=finished raised gaierror>
> Traceback (most recent call last):
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\concurrent\futures\thread.py", line 57, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\socket.py", line 914, in getaddrinfo
>     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
> socket.gaierror: [Errno 11001] getaddrinfo failed
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\concurrent\futures\_base.py", line 328, in _invoke_callbacks   
>     callback(self)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\futures.py", line 371, in _call_set_state
>     dest_loop.call_soon_threadsafe(_set_state, destination, source)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 756, in call_soon_threadsafe     
>     self._check_closed()
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 504, in _check_closed
>     raise RuntimeError('Event loop is closed')
> RuntimeError: Event loop is closed
> 2021-10-31 14:51:20 ERROR    concurrent.futures  - exception calling callback for <Future at 0x11ccffb0c70 state=finished returned list>
> Traceback (most recent call last):
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\concurrent\futures\_base.py", line 328, in _invoke_callbacks   
>     callback(self)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\futures.py", line 371, in _call_set_state
>     dest_loop.call_soon_threadsafe(_set_state, destination, source)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 756, in call_soon_threadsafe     
>     self._check_closed()
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 504, in _check_closed
>     raise RuntimeError('Event loop is closed')
> RuntimeError: Event loop is closed
> [2021-10-31 14:51:23 +0100] [2868] [ERROR] Experienced exception while trying to serve
> Traceback (most recent call last):
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sanic\app.py", line 1129, in run
>     serve(**server_settings)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sanic\server.py", line 888, in serve
>     trigger_events(before_start, loop)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sanic\server.py", line 696, in trigger_events    
>     loop.run_until_complete(result)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 608, in run_until_complete       
>     return future.result()
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\run.py", line 253, in load_agent_on_start
>     _broker = await EventBroker.create(endpoints.event_broker, loop=loop)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\broker.py", line 32, in create 
>     return await _create_from_endpoint_config(obj, loop)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\broker.py", line 91, in _create_from_endpoint_config
>     broker = await SQLEventBroker.from_endpoint_config(endpoint_config)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\sql.py", line 65, in from_endpoint_config
>     return cls(host=broker_config.url, **broker_config.kwargs)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\sql.py", line 54, in __init__  
>     self.engine = sqlalchemy.create_engine(engine_url)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sqlalchemy\engine\__init__.py", line 525, in create_engine
>     return strategy.create(*args, **kwargs)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sqlalchemy\engine\strategies.py", line 87, in create
>     dbapi = dialect_cls.dbapi(**dbapi_args)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sqlalchemy\dialects\sqlite\pysqlite.py", line 430, in dbapi
>     from sqlite3 import dbapi2 as sqlite
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\sqlite3\__init__.py", line 23, in <module>
>     from sqlite3.dbapi2 import *
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\sqlite3\dbapi2.py", line 27, in <module>
>     from _sqlite3 import *
> ImportError: DLL load failed while importing _sqlite3: Onvoldoende geheugenbronnen beschikbaar om deze opdracht te verwerken.
> Process SpawnProcess-1:
> Traceback (most recent call last):
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\multiprocessing\process.py", line 313, in _bootstrap
>     self.run()
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\multiprocessing\process.py", line 108, in run
>     self._target(*self._args, **self._kwargs)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\cli\x.py", line 88, in _rasa_service        
>     serve_application(
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\run.py", line 220, in serve_application    app.run(
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sanic\app.py", line 1129, in run
>     serve(**server_settings)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sanic\server.py", line 888, in serve
>     trigger_events(before_start, loop)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sanic\server.py", line 696, in trigger_events    
>     loop.run_until_complete(result)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 608, in run_until_complete       
>     return future.result()
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\run.py", line 253, in load_agent_on_start
>     _broker = await EventBroker.create(endpoints.event_broker, loop=loop)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\broker.py", line 32, in create 
>     return await _create_from_endpoint_config(obj, loop)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\broker.py", line 91, in _create_from_endpoint_config
>     broker = await SQLEventBroker.from_endpoint_config(endpoint_config)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\sql.py", line 65, in from_endpoint_config
>     return cls(host=broker_config.url, **broker_config.kwargs)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasa\core\brokers\sql.py", line 54, in __init__  
>     self.engine = sqlalchemy.create_engine(engine_url)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sqlalchemy\engine\__init__.py", line 525, in create_engine
>     return strategy.create(*args, **kwargs)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sqlalchemy\engine\strategies.py", line 87, in create
>     dbapi = dialect_cls.dbapi(**dbapi_args)
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sqlalchemy\dialects\sqlite\pysqlite.py", line 430, in dbapi
>     from sqlite3 import dbapi2 as sqlite
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\sqlite3\__init__.py", line 23, in <module>
>     from sqlite3.dbapi2 import *
>   File "c:\users\boris\anaconda3\envs\coalaconda\lib\sqlite3\dbapi2.py", line 27, in <module>
>     from _sqlite3 import *
> ImportError: DLL load failed while importing _sqlite3: Onvoldoende geheugenbronnen beschikbaar om deze opdracht te verwerken.
> sys:1: RuntimeWarning: coroutine 'BaseEventLoop.create_server' was never awaited
> RuntimeWarning: Enable tracemalloc to get the object allocation traceback
> 2021-10-31 14:52:21 WARNING  rasax.community.services.model_service  - Could not run model discovery.
> [2021-10-31 14:52:21 +0100] [16380] [INFO] Goin' Fast @ http://0.0.0.0:5002
> 2021-10-31 14:52:21 INFO     sanic.root  - Goin' Fast @ http://0.0.0.0:5002
> 
> The server is running at http://localhost:5002/login?username=me&password=63e3845UCw88
> 
> [2021-10-31 14:52:21 +0100] [16380] [INFO] Starting worker [16380]
> 2021-10-31 14:52:21 INFO     sanic.root  - Starting worker [16380]
> 2021-10-31 14:52:22 ERROR    asyncio  - Task was destroyed but it is pending.
> task: <Task pending name='Task-9' coro=<TCPConnector._resolve_host() running at 
c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py:865> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\futures.py:357, <TaskWakeupMethWrapper object at 0x0000011CCFF54CA0>()]> cb=[TCPConnector._create_direct_connection.<locals>.drop_exception() at c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py:1002]>
> 2021-10-31 14:52:22 ERROR    asyncio  - Task was destroyed but it is pending!
> task: <Task pending name='Task-8' coro=<TCPConnector._resolve_host() running at c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py:865> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\futures.py:357, <TaskWakeupMethWrapper object at 0x0000011CCFFB0AF0>()]> cb=[TCPConnector._create_direct_connection.<locals>.drop_exception() at c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py:1002]>

When trying to access the models through Rasa X it states “There are no trained models” and gives the following error in the terminal:

[2021-10-31 14:56:20 +0100] [16380] [ERROR] Exception occurred while handling uri: 'http://localhost:5002/api/projects/default/models?limit=1&offset=0&tag=production'
Traceback (most recent call last):
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py", line 969, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 1017, in create_connection       
    raise exceptions[0]
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 1002, in create_connection       
    sock = await self._connect_sock(
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\base_events.py", line 916, in _connect_sock
    await self.sock_connect(sock, address)
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\proactor_events.py", line 702, in sock_connect
    return await self._proactor.connect(sock, address)
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\asyncio\windows_events.py", line 595, in finish_connect        
    ov.getresult()
ConnectionRefusedError: [WinError 1225] De netwerkverbinding is geweigerd door de externe computer

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

Traceback (most recent call last):
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\sanic\app.py", line 938, in handle_request       
    response = await response
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\api\decorators.py", line 216, in 
decorated_function
    return await await_and_return_response(args, kwargs, request)
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\api\decorators.py", line 146, in 
await_and_return_response
    response = await response
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\api\blueprints\models.py", line 44, in get_models
    models, total_models = await _model_service(request).get_models(
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\services\model_service.py", line 
747, in get_models
    minimum_compatible_version = await self.minimum_compatible_version()
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\services\model_service.py", line 
160, in minimum_compatible_version
    info = await stack_service.version()
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\rasax\community\services\stack_service.py", line 
93, in version
    response = await session.get(
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\client.py", line 520, in _request        
    conn = await self._connector.connect(
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py", line 535, in connect      
    proto = await self._create_connection(req, traces, timeout)
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "c:\users\boris\anaconda3\envs\coalaconda\lib\site-packages\aiohttp\connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:5005 ssl:default [De netwerkverbinding is geweigerd door de externe computer]
2021-10-31 14:56:20 ERROR    sanic.root  - Exception occurred while handling uri: 'http://localhost:5002/api/projects/default/models?limit=1&offset=0&tag=production'

Many thanks!

@Hadzy can you try clean your cache and browser cookies and let me know please.

Hi Nik, Thanks for the response. Unfortunately, clearing browser cache and cookies did not help. I get the same error as previously.

I do have the previous conversations loaded now though, but not the models.

@Hadzy is that your rasa x is opening in the browser window?

@nik202, yes rasa x opens up in the browser, but doesn’t show the models.

@Hadzy did you trained your model before using rasa train --debug if not before running rasa x please run this command and share me the screenshot what you get?

@nik202 I will do that and respond. However, in the mean time I tried updating rasa, but now when I run RASA X I get the same issue as in RASA X running Error: Make sure to start Rasa X with valid data and valid domain and config files - #22 by nik202. I believe the reason is because it is incompatible with my rasa.db files. Any way to keep the files or the data from it without removing the files?

@Hadzy can you downgrade to rasa x 0.39.3? and follow this solution thread please Installing rasa - #7 by nik202

@nik202 I am making a new environment within conda and following your installation steps. During installation of Rasa X I got the message INFO: This is taking longer than usual. To prevent this I want to downgrade the pip version, however when running pip install pip==20.2 I get the following message:

@Hadzy install without that please, if you getting longer time then only and mention --user at the end of command.

@nik202 I did the installation, but still the same message when running rasa x. Also with a clean rasa init model it gives the same message:

$ rasa x
Starting Rasa X in local mode... 🚀
Traceback (most recent call last):
  File "c:\users\boris\anaconda3\envs\coala\lib\site-packages\rasa\cli\x.py", line 496, in run_locally
    local.main(
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\local.py", line 234, in main
    sql_migrations.run_migrations(session)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\sql_migrations.py", line 25, in run_migrations        
    _run_schema_migrations(session)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\sql_migrations.py", line 41, in _run_schema_migrations
    _run_alembic_migration(alembic_config)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\sql_migrations.py", line 65, in _run_alembic_migration
    command.upgrade(alembic_config, target_revision)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\command.py", line 298, in upgrade
    script.run_env()
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\base.py", line 489, in run_env
    util.load_python_file(self.dir, "env.py")
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\util\pyfiles.py", line 98, in load_python_file
    module = load_module_py(module_id, path)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\util\compat.py", line 184, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\database\schema_migrations\alembic\env.py", line 96, in <module>
    run_migrations_online()
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\database\schema_migrations\alembic\env.py", line 86, in run_migrations_online        
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\runtime\environment.py", line 846, in run_migrations
    self.get_context().run_migrations(**kw)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\runtime\migration.py", line 511, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\command.py", line 287, in upgrade
    return script._upgrade_revs(revision, rev)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\base.py", line 364, in _upgrade_revs
    revs = list(revs)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\revision.py", line 777, in _iterate_revisions
    uppers = util.dedupe_tuple(self.get_revisions(upper))
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\revision.py", line 321, in get_revisions
    resolved_id, branch_label = self._resolve_revision_number(id_)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\revision.py", line 501, in _resolve_revision_number
    self._revision_map
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\util\langhelpers.py", line 230, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\revision.py", line 123, in _revision_map
    for revision in self._generator():
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\base.py", line 112, in _load_revisions
    script = Script._from_filename(self, vers, file_)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\script\base.py", line 906, in _from_filename
    module = util.load_python_file(dir_, filename)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\util\pyfiles.py", line 98, in load_python_file
    module = load_module_py(module_id, path)
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\alembic\util\compat.py", line 184, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\database\schema_migrations\alembic\versions\migration_2019_06_03_initial_migration_2a216ed121dd.py", line 14, in <module>
    import rasax.community.database.schema_migrations.alembic.utils as migration_utils
  File "C:\Users\Boris\AppData\Roaming\Python\Python38\site-packages\rasax\community\database\schema_migrations\alembic\utils.py", line 12, in <module>
    from sqlalchemy.engine import reflection, RowProxy, Connection
ImportError: cannot import name 'RowProxy' from 'sqlalchemy.engine' (C:\Users\Boris\AppData\Roaming\Python\Python38\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/.

@Hadzy install pip install SQLAlchemy==1.3.22 and share next error please.

@nik202 It found the new model and functions again. Thank you.

If anybody has the same issue, creating a new environment and following the steps provided by @nik202 should solve it.

@Hadzy Please mark this as solution thread for other: Installing rasa - #7 by nik202 it have all complete steps of installing mate :slight_smile: thanks.