Unable to install rasa 1.7.0

I have been trying to install rasa on my Window 10 machine. But no success so far. Environment wise I have python 3.7, pip 20.3. When I run pip install rasa==1.7.0 on anaconda powershell it takes ages to download the dependencies and finally errors out as:

ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_internal\cli\base_command.py", line 224, in _main
    status = self.run(options, args)
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_internal\cli\req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_internal\commands\install.py", line 321, in run
    reqs, check_supported_wheels=not options.target_dir
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 122, in resolve
    requirements, max_rounds=try_to_avoid_resolution_too_deep,
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 445, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 325, in resolve
    for item in self.state.criteria.items()
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 326, in <listcomp>
    if not self._is_current_pin_satisfying(*item)
  File "C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 193, in _is_current_pin_satisfying
    for r in criterion.iter_requirement()
AttributeError: 'NoneType' object has no attribute 'iter_requirement'

I could not find much details on this. As already dependencies were taking lot of time, I came across New resolver takes time article which states pip 20.3 takes more time. One way to solve it is to give exact versions of dependencies which I was not sure of as am quite new to rasa. I tried using older resolver as pip install rasa==1.7.0 --use-deprecated=legacy-resolver. After sometime it errored out as below:

ERROR: Could not find a version that satisfies the requirement jaxlib>=0.1.51 (from dopamine-rl->tensor2tensor~=1.14.0->rasa==1.7.0) (from versions: none)
ERROR: No matching distribution found for jaxlib>=0.1.51 (from dopamine-rl->tensor2tensor~=1.14.0->rasa==1.7.0)

To resolve this: I did dopamine install of different version as suggested here asI was not sure what version to go with. The packages started downloading and finally gave the dependency conflict error, occurred due to usage of legacy resolver.

ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
tensorflow-metadata 0.26.0 requires absl-py<0.11,>=0.9, but you'll have absl-py 0.11.0 which is incompatible.
kfac 0.2.3 requires tensorflow-probability==0.8, but you'll have tensorflow-probability 0.7.0 which is incompatible.

If we go with new resolver then it takes lot of time in resolving dependencies. Also we are not sure what all dependency versions needs to be downloaded to fine tune it.

Any help pointers here would be much appreciated.

Try installing jaxlib with conda first and then install rasa

conda install jaxlib>=0.1.51
pip install rasa==1.7.0

I installed dopamine using the below command which resolved jaxlib error. pip install dopamine-rl==3.0.1

Now I am getting conflict with dependency versions as am using legacy resolver. I have updated the topic. I tried below, this seems to work fine. No errors now. Hope remaining steps goes fine.

pip install dopamine-rl==3.0.1
pip install absl-py>=0.9
pip install rasa==1.7.0 --use-deprecated=legacy-resolver

Installed tensor flow as: conda install tensorflow==1.15.0

Now I get this error for tensor flow. Not sure if this is because of using legacy resolver.

The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use tfp.distributionsinstead oftf.distributions`

ImportError: cannot import name ‘Layer’ from ‘tensorflow.python.keras.engine.base_layer’ (C:\Users\pranav\Anaconda3\envs\py37\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py)

I got tensor flow installation fixed by installing nightly builds as:

pip install --upgrade --user tf-nightly tfp-nightly

Downloaded and installed Spacy from here.

Now stuck at rasa train with below error. This seems like a never ending ride :slight_smile: . Tensor flow version 1.15.0 and Rasa version is 1.7.0

2020-12-23 17:51:41 INFO     rasa.model  - Data (domain) for Core model section changed.
2020-12-23 17:51:41 INFO     rasa.model  - Data (messages) for NLU model section changed.
2020-12-23 17:51:41 INFO     rasa.model  - Data (nlg) for NLG templates section changed.
Training Core model...
Traceback (most recent call last):
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\core\policies\ensemble.py", line 320, in from_dict
    constr_func = registry.policy_from_module_path(policy_name)
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\core\registry.py", line 21, in policy_from_module_path
    module_path, lookup_path="rasa.core.policies.registry"
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\utils\common.py", line 208, in class_from_module_path
    m = importlib.import_module(lookup_path)
  File "c:\users\user\anaconda3\envs\py37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\core\policies\registry.py", line 5, in <module>
    from rasa.core.policies.embedding_policy import EmbeddingPolicy
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\core\policies\embedding_policy.py", line 22, in <module>
    from rasa.utils import train_utils
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\utils\train_utils.py", line 10, in <module>
    from tensor2tensor.models.transformer import (
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\tensor2tensor\models\__init__.py", line 25, in <module>
    from tensor2tensor.layers import modalities  # pylint: disable=g-import-not-at-top
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\tensor2tensor\layers\modalities.py", line 28, in <module>
    from tensor2tensor.layers import common_attention
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\tensor2tensor\layers\common_attention.py", line 954, in <module>
    def attention_bias_to_padding(attention_bias, cast_fn=tf.to_float):
AttributeError: module 'tensorflow' has no attribute 'to_float'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\user\anaconda3\envs\py37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\user\anaconda3\envs\py37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\user\Anaconda3\envs\py37\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\__main__.py", line 76, in main
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\cli\train.py", line 76, in train
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\train.py", line 50, in train
  File "c:\users\user\anaconda3\envs\py37\lib\asyncio\base_events.py", line 587, in run_until_complete
    return future.result()
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\train.py", line 101, in train_async
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\train.py", line 188, in _train_async_internal
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\train.py", line 223, in _do_training
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\train.py", line 361, in _train_core_with_validated_data
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\core\train.py", line 44, in train
    policies = config.load(policy_config)
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\core\config.py", line 28, in load
    return PolicyEnsemble.from_dict(config_data)
  File "c:\users\user\anaconda3\envs\py37\lib\site-packages\rasa\core\policies\ensemble.py", line 331, in from_dict
rasa.core.policies.ensemble.InvalidPolicyConfig: Module for policy 'KerasPolicy' could not be loaded. Please make sure the name is a valid policy.

UPDATE: Was able to resolve this by changing the common_attention.py line 954 as:

#def attention_bias_to_padding(attention_bias, cast_fn=tf.to_float):
def attention_bias_to_padding(attention_bias, cast_fn=lambda x: tf.cast(x, tf.float32)):

Getting errors in other parts now like: AttributeError: module 'tensorflow' has no attribute 'contrib'. Can’t keep changing code. But why am I getting these errors when I have TF 1.15.0 installed, this package change seems to be from TF 2.x.

py37) PS C:\BotProject> pip show tensorflow                                                                                                                                                     Name: tensorflow
Version: 1.15.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: c:\users\user\anaconda3\envs\py37\lib\site-packages
Requires: google-pasta, opt-einsum, termcolor, keras-preprocessing, tensorboard, wheel, absl-py, numpy, gast, astor, tensorflow-estimator, wrapt, grpcio, protobuf, keras-applications, six

Tried this. I got the below error:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - jaxlib[version='>=0.1.51']

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to


and use the search bar at the top of the page.

I got this fixed. Installed Tensorflow first then Rasa. With this the correct packages got installed. Not getting these errors now.

How did you fix it ( install rasa 1.7.0)? Thank you

I was getting jaxlib library error as stated. To resolve it I installed dopamine-rl like I updated above in the thread. With that the jaxlib error went away. Later I was getting other errors, so I installed tensorflow 1.15.0 first then rasa 1.7. Things went fine after that with couple of hiccups with other library versions, I kept updating them wherever required.