ModuleNotFoundError: No module named 'rasa.core.slots'

Version: Rasa X 0.33.0

Hi,

After loading my project from Github, I tried to navigate to the domain, but it ins’t loaded into the UI. I looked at the logs and I’m getting the following exception:

rasa-x_1           | [2020-11-05 16:38:18 +0000] [20] [ERROR] Exception occurred while handling uri: 'http://10.0.2.42/api/domain'
rasa-x_1           | Traceback (most recent call last):
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasa/shared/core/slots.py", line 110, in resolve_by_type
rasa-x_1           |     return rasa.shared.utils.common.class_from_module_path(type_name)
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasa/shared/utils/common.py", line 19, in class_from_module_path
rasa-x_1           |     m = importlib.import_module(module_name)
rasa-x_1           |   File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
rasa-x_1           |     return _bootstrap._gcd_import(name[level:], package, level)
rasa-x_1           |   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
rasa-x_1           |   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
rasa-x_1           |   File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
rasa-x_1           | ModuleNotFoundError: No module named 'rasa.core.slots'
rasa-x_1           | 
rasa-x_1           | During handling of the above exception, another exception occurred:
rasa-x_1           | 
rasa-x_1           | Traceback (most recent call last):
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/sanic/app.py", line 973, in handle_request
rasa-x_1           |     response = await response
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasax/community/api/decorators.py", line 213, in decorated_function
rasa-x_1           |     return await await_and_return_response(args, kwargs, request)
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasax/community/api/decorators.py", line 143, in await_and_return_response
rasa-x_1           |     response = await response
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasax/community/api/blueprints/project.py", line 298, in get_domain
rasa-x_1           |     return response.text(domain_service.dump_cleaned_domain_yaml(domain))
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasax/community/services/domain_service.py", line 229, in dump_cleaned_domain_yaml
rasa-x_1           |     cleaned_domain = RasaDomain.from_dict(domain).cleaned_domain()
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasa/shared/core/domain.py", line 167, in from_dict
rasa-x_1           |     slots = cls.collect_slots(data.get(KEY_SLOTS, {}))
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasa/shared/core/domain.py", line 288, in collect_slots
rasa-x_1           |     slot_class = Slot.resolve_by_type(slot_type)
rasa-x_1           |   File "/usr/local/lib/python3.7/site-packages/rasa/shared/core/slots.py", line 113, in resolve_by_type
rasa-x_1           |     f"Failed to find slot type, '{type_name}' is neither a known type nor "
rasa-x_1           | rasa.shared.core.slots.InvalidSlotTypeException: Failed to find slot type, 'rasa.core.slots.TextSlot' is neither a known type nor user-defined. If you are creating your own slot type, make sure its module path is correct. You can find all build in types at https://rasa.com/docs/rasa/domain#slots

This error stops being raised after a model was trained.

Hi @santteegt, since rasa.core.slots has moved to rasa.shared.core.slots in Rasa 2.0, this looks like either there’s some old model (trained e.g. with an alpha release of Rasa 2.0), or in your domain there’s rasa.core.slots somewhere. Could you maybe first check (or share here) your domain file?

Hi @SamS,

Here’s my domain file

Thanks @santteegt. What version of Rasa are you using along Rasa X 0.33.0? And maybe to understand your situation better: Are you able to get the error repeatedly? Is it that you want to use a previously trained model in Rasa X, but the domain will only load up if you retrain the model? Do you know what version of Rasa was used for that old model? I’m trying to find out what could be the issue because so far this all sounds quite like a mystery :slight_smile:

Hi @SamS,

Sorry for my late reply. Seems that the problem was indeed due to a previously stored model that was trained using Rasa 1.x. I did a clean install and the error disappeared