Unable to run rasa train in rasa 1.5.3 version ImportError: Cannot retrieve policy from path 'KerasPolicy'

Here are the details of my installations

  • OS: Windows 10
  • Used anaconda environment for python 3.7
  • Rasa Version: 1.5.3
  • TensorFlow Version: 1.15.4 (Installs along with rasa installation)

After successful installation, while using the command [rasa train] the ImportError: Cannot retrieve a policy from path ‘KerasPolicy’ is displayed. ImportError: This version of TensorFlow Datasets requires TensorFlow version >= 2.1.0; Detected an installation of version 1.15.4. Please upgrade TensorFlow to proceed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “c:\users\smrithi.fredric\appdata\local\continuum\anaconda3\envs\ollie\lib\site-packages\rasa\core\policies\ensemble.py”, line 318, in from_dict constr_func = registry.policy_from_module_path(policy_name) File “c:\users\smrithi.fredric\appdata\local\continuum\anaconda3\envs\ollie\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 ‘KerasPolicy’

During handling of the above exception, another exception occurred:

File “c:\users\smrithi.fredric\appdata\local\continuum\anaconda3\envs\ollie\lib\site-packages\rasa\core\policies\ensemble.py”, line 329, in from_dict “”.format(policy_name) rasa.core.policies.ensemble.InvalidPolicyConfig: Module for policy ‘KerasPolicy’ could not be loaded. Please make sure the name is a valid policy.

.

After I upgrade tensorflow to version 2.1.0, I get another error def attention_bias_to_padding(attention_bias, cast_fn=tf.to_float): AttributeError: module ‘tensorflow’ has no attribute ‘to_float’

Can someone please help me? I need to work on a project with rasa version 1.5.3 and any suggestions would be highly appreciated.

Thanks, Smrithi

Hey @smritmix3, can you try running rasa --version to see whether you definitely have the right version installed?

This is the version of rasa I am using.

I was running into a Jaxlib error when I was did a pip install rasa==1.5.3 on my windows 10 laptop. [ERROR: Could not find a version that satisfies the requirement jaxlib>=0.1.51 (from dopamine-rl->tensor2tensor~=1.14.0->rasa==1.5.3) (from versions: none)

I was able to fix it by referring to the solution mentioned in this link.

After that, I was encountering the 2 TensorFlow dependency errors I mentioned in my previous query.

FIX: I downgraded the tensorflow_datasets to 1.1.0 pip install tensorflow-datasets==1.1.0

This worked for me.

@akelad, Thanks for responding to the query. Regards, Smrithi