Getting Module for policy 'MemoizationPolicy' could not be loaded while trying to execute rasa init --no-prompt

Traceback (most recent call last): File “d:\venv\lib\site-packages\rasa\core\registry.py”, line 21, in policy_from_module_path module_path, lookup_path=“rasa.core.policies.registry” File “d:\venv\lib\site-packages\rasa\utils\common.py”, line 190, in class_from_module_path m = importlib.import_module(lookup_path) File “C:\Anaconda3\lib\importlib_init_.py”, line 127, in import_module return _bootstrap.gcd_import(name[level:], package, level) File “”, line 1006, in gcd_import File “”, line 983, in find_and_load File “”, line 967, in find_and_load_unlocked File “”, line 677, in load_unlocked File “”, line 728, in exec_module File “”, line 219, in call_with_frames_removed File “d:\venv\lib\site-packages\rasa\core\policies\registry.py”, line 5, in from rasa.core.policies.embedding_policy import EmbeddingPolicy File “d:\venv\lib\site-packages\rasa\core\policies\embedding_policy.py”, line 22, in from rasa.utils import train_utils File “d:\venv\lib\site-packages\rasa\utils\train_utils.py”, line 9, in from tensor2tensor.models.transformer import ( File "d:\venv\lib\site-packages\tensor2tensor\models_init.py", line 36, in from tensor2tensor.models import mtf_transformer2 File “d:\venv\lib\site-packages\tensor2tensor\models\mtf_transformer2.py”, line 23, in from mesh_tensorflow.transformer import moe File "d:\venv\lib\site-packages\mesh_tensorflow\transformer_init.py", line 23, in import mesh_tensorflow.transformer.dataset File “d:\venv\lib\site-packages\mesh_tensorflow\transformer\dataset.py”, line 94, in import tensorflow_datasets as tfds File "d:\venv\lib\site-packages\tensorflow_datasets_init.py", line 46, in from tensorflow_datasets.core import tf_compat File "d:\venv\lib\site-packages\tensorflow_datasets\core_init.py", line 25, in from tensorflow_datasets.core.dataset_builder import BeamBasedBuilder File “d:\venv\lib\site-packages\tensorflow_datasets\core\dataset_builder.py”, line 34, in from tensorflow_datasets.core import dataset_utils File “d:\venv\lib\site-packages\tensorflow_datasets\core\dataset_utils.py”, line 29, in from tensorflow_datasets.core import utils File "d:\venv\lib\site-packages\tensorflow_datasets\core\utils_init.py", line 22, in from tensorflow_datasets.core.utils.tqdm_utils import * File “d:\venv\lib\site-packages\tensorflow_datasets\core\utils\tqdm_utils.py”, line 25, in from tqdm import auto as tqdm_lib ImportError: cannot import name ‘auto’ from ‘tqdm’ (C:\Anaconda3\lib\site-packages\tqdm_init.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “d:\venv\lib\site-packages\rasa\core\policies\ensemble.py”, line 319, in from_dict constr_func = registry.policy_from_module_path(policy_name) File “d:\venv\lib\site-packages\rasa\core\registry.py”, line 24, in policy_from_module_path raise ImportError(f"Cannot retrieve policy from path ‘{module_path}’") ImportError: Cannot retrieve policy from path ‘MemoizationPolicy’

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “C:\Anaconda3\lib\runpy.py”, line 193, in run_module_as_main “main”, mod_spec) File “C:\Anaconda3\lib\runpy.py”, line 85, in run_code exec(code, run_globals) File "D:\venv\Scripts\rasa.exe_main.py", line 7, in File "d:\venv\lib\site-packages\rasa_main.py", line 76, in main cmdline_arguments.func(cmdline_arguments) File “d:\venv\lib\site-packages\rasa\cli\train.py”, line 76, in train kwargs=extract_additional_arguments(args), File “d:\venv\lib\site-packages\rasa\train.py”, line 45, in train kwargs=kwargs, File “C:\Anaconda3\lib\asyncio\base_events.py”, line 568, in run_until_complete return future.result() File “d:\venv\lib\site-packages\rasa\train.py”, line 96, in train_async kwargs, File “d:\venv\lib\site-packages\rasa\train.py”, line 182, in _train_async_internal kwargs=kwargs, File “d:\venv\lib\site-packages\rasa\train.py”, line 217, in _do_training kwargs=kwargs, File “d:\venv\lib\site-packages\rasa\train.py”, line 346, in _train_core_with_validated_data kwargs=kwargs, File “d:\venv\lib\site-packages\rasa\core\train.py”, line 43, in train policies = config.load(policy_config) File “d:\venv\lib\site-packages\rasa\core\config.py”, line 28, in load return PolicyEnsemble.from_dict(config_data) File “d:\venv\lib\site-packages\rasa\core\policies\ensemble.py”, line 327, in from_dict “”.format(policy_name) rasa.core.policies.ensemble.InvalidPolicyConfig: Module for policy ‘MemoizationPolicy’ could not be loaded. Please make sure the name is a valid policy.

Hello @gokila.b, can you please provide some context to when you are seeing this issue? Did you install all of the dev requirements for the policies you are using?

Thanks

I’ve got a similar error just following the « Getting Started with Rasa » (Getting Started with Rasa)

So I’ve typed:

sudo pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple

which seems to work fine but when I’ve typed:

sudo rasa init

I’ve got a lot of errors among them:

rasa.core.policies.ensemble.InvalidPolicyConfig: Module for policy ‘MemoizationPolicy’ could not be loaded. Please make sure the name is a valid policy.

In fact, it was a dependencies nightmare.

So what I’ve done to get a rasa chatbot up and running:

  1. Reinstall dask (but I’m not sure this step is mandatory)

sudo pip3 install "dask[complete]"

  1. Downgraded my version of pandas

sudo pip3 install pandas==0.19.2

  1. Upgraded tqdm

sudo pip3 install -U tqdm

  1. Upgraded OpenAI gym

sudo pip3 install -U gym

Et voilà!

Claude COULOMBE

I am seeing this thing when i use command rasa init in venv

is rasa-x pip still supported? or just inside a container now?

Try using rasa-x rather than rasa library:

virtualenv -p 3.6.8 rasaenvx

rasaenvx\Scripts\activate

pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple

rasa init --no-prompt