Rasa init error (unsolved)

I am getting an error that seems to be common on the forum but found no solution in any of threads so I am starting my own.

I followed the Rasa installation guide until I reached the part to train an initial model (using rasa init), it only installs the data, actions, test, config, domain, endpoints files but runs into an error at the end and doesn’t include the models folder. The error is the following:

“AttributeError: module ‘tensorflow’ has no attribute ‘keras’”

Please note that I have already installed tensorflow, and I even installed keras separately and I still get this error. This is my rasa version:

Rasa Version : 3.5.3 Minimum Compatible Version: 3.5.0 Rasa SDK Version : 3.5.0 Python Version : 3.8.0 Operating System : Windows-10-10.0.19041-SP0

I have tried pip install tensorflow and conda install tensorflow and both end up with the same error and no solution.

Maybe the version of tensorflow (2.11.1) is incompatible with python 3.8?

I have uninstalled keras using pip, and then did pip install tensorflow and when I write ‘rasa train’ I still get the error:

class RasaTrainingLogger(tf.keras.callbacks.Callback):

AttributeError: module ‘tensorflow’ has no attribute ‘keras’

Tried updating the tensorflow version but it is incompatible with rasa.

ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. rasa 3.5.3 requires protobuf<3.20,>=3.9.2, but you have protobuf 4.22.1 which is incompatible. rasa 3.5.3 requires tensorflow<2.12.0,>=2.11.0; sys_platform != “darwin” or platform_machine != “arm64”, but you have tensorflow 2.12.0 which is incompatible. rasa 3.5.3 requires tensorflow-intel<2.12.0,>=2.11.0; sys_platform == “win32”, but you have tensorflow-intel 2.12.0 which is incompatible

Update: I did rasa train after updating tensorflow and it worked, the models folder now exists for my VSCode file.

What I did:

pip install --upgrade tensorflow

rasa train

Solved it, but will I run into future errors if this newest version of tensorflow is apparently incompatible with Rasa?

Hey guys! I had the same problems now but I have the solution.

  1. run: pip install --upgrade tensorflow

  2. it will download stuff but then will give you an error warning message that rasa 5.10 is using tensorflow x.y version and tensorflow-intel x.y version (cannot remember the exact version).

  3. just pip install the version it tells you it is compatible with your rasa

After this I could train the model.

Hope this helps, Cheers!

2 Likes

this worked for me, but after i upgraded my venv’s python version to something 3.9.x or above to 3.10. Anything like 3.8 or 3.7 has a bug which won’t let u do this!