ImportError: cannot import name 'data_adapter' from 'keras.engine' (C:\Python39\lib\site-packages\keras\engine\__init__.py)

I have installed rasa on my windows 10 system. After it was showing error for the compatiblity so I downloaded the tensorflow2.5.0. But still I am getting the error give below while traing the NLU

Training NLU model… Using TensorFlow backend. Traceback (most recent call last): File “C:\Python39\lib\runpy.py”, line 194, in _run_module_as_main return run_code(code, main_globals, None, File “C:\Python39\lib\runpy.py”, line 87, in run_code exec(code, run_globals) File "C:\Python39\Scripts\rasa.exe_main.py", line 7, in File "C:\Python39\lib\site-packages\rasa_main.py", line 118, in main cmdline_arguments.func(cmdline_arguments) File “C:\Python39\lib\site-packages\rasa\cli\scaffold.py”, line 235, in run init_project(args, path) File “C:\Python39\lib\site-packages\rasa\cli\scaffold.py”, line 130, in init_project print_train_or_instructions(args, path) File “C:\Python39\lib\site-packages\rasa\cli\scaffold.py”, line 69, in print_train_or_instructions training_result = rasa.train(domain, config, training_files, output) File “C:\Python39\lib\site-packages\rasa\api.py”, line 109, in train return rasa.utils.common.run_in_loop( File “C:\Python39\lib\site-packages\rasa\utils\common.py”, line 296, in run_in_loop result = loop.run_until_complete(f) File “C:\Python39\lib\asyncio\base_events.py”, line 616, in run_until_complete return future.result() File “C:\Python39\lib\site-packages\rasa\model_training.py”, line 108, in train_async return await _train_async_internal( File “C:\Python39\lib\site-packages\rasa\model_training.py”, line 288, in _train_async_internal await _do_training( File “C:\Python39\lib\site-packages\rasa\model_training.py”, line 334, in _do_training model_path = await _train_nlu_with_validated_data( File “C:\Python39\lib\site-packages\rasa\model_training.py”, line 758, in train_nlu_with_validated_data await rasa.nlu.train.train( File “C:\Python39\lib\site-packages\rasa\nlu\train.py”, line 96, in train trainer = Trainer( File “C:\Python39\lib\site-packages\rasa\nlu\model.py”, line 164, in init components.validate_requirements(cfg.component_names) File “C:\Python39\lib\site-packages\rasa\nlu\components.py”, line 58, in validate_requirements from rasa.nlu import registry File “C:\Python39\lib\site-packages\rasa\nlu\registry.py”, line 12, in from rasa.nlu.classifiers.diet_classifier import DIETClassifier File “C:\Python39\lib\site-packages\rasa\nlu\classifiers\diet_classifier.py”, line 24, in from rasa.utils.tensorflow.models import RasaModel, TransformerRasaModel File “C:\Python39\lib\site-packages\rasa\utils\tensorflow\models.py”, line 47, in from rasa.utils.tensorflow.temp_keras_modules import TmpKerasModel File “C:\Python39\lib\site-packages\rasa\utils\tensorflow\temp_keras_modules.py”, line 17, in from keras.engine import training, training_utils, data_adapter, base_layer ImportError: cannot import name ‘data_adapter’ from ‘keras.engine’ (C:\Python39\lib\site-packages\keras\engine_init.py)

the libraries downloaded in my system are:

pip3 freeze absl-py==0.13.0 aio-pika==6.8.0 aiofiles==0.7.0 aiohttp==3.7.4 aiormq==3.3.1 appdirs==1.4.4 APScheduler==3.7.0 astunparse==1.6.3 async-generator==1.10 async-timeout==3.0.1 attrs==21.2.0 beautifulsoup4==4.9.3 bidict==0.21.4 boto3==1.19.12 botocore==1.22.12 cachetools==4.2.4 certifi==2021.5.30 cffi==1.15.0 chardet==3.0.4 charset-normalizer==2.0.4 clang==5.0 click==8.0.1 cloudpickle==1.6.0 colorama==0.4.4 colorclass==2.2.0 coloredlogs==15.0.1 colorhash==1.0.3 comtypes==1.1.10 cryptography==3.4.8 cycler==0.10.0 decorator==4.4.2 distlib==0.3.2 dlib==19.19.0 dm-tree==0.1.6 dnspython==1.16.0 docopt==0.6.2 efficientnet==1.0.0 face-recognition==1.4.0 face-recognition-models==0.3.0 fbmessenger==6.0.0 filelock==3.0.12 flatbuffers==1.12 future==0.18.2 gast==0.4.0 google-auth==2.3.3 google-auth-oauthlib==0.4.6 google-pasta==0.2.0 greenlet==1.1.2 grpcio==1.34.1 h11==0.9.0 h5py==3.1.0 httpcore==0.11.1 httplib2==0.20.2 httptools==0.3.0 httpx==0.15.4 humanfriendly==10.0 idna==2.10 image-classifiers==1.0.0 imageio==2.10.1 imageio-ffmpeg==0.4.5 jmespath==0.10.0 joblib==1.0.1 jsonpickle==2.0.0 jsonschema==3.2.0 kafka-python==2.0.2 Keras==2.3.1 Keras-Applications==1.0.8 keras-nightly==2.5.0.dev2021032900 Keras-Preprocessing==1.1.2 kiwisolver==1.3.1 Markdown==3.3.4 matplotlib==3.3.4 mattermostwrapper==2.2 MouseInfo==0.1.3 multidict==5.0.0 networkx==2.5.1 nltk==3.6.2 numpy==1.19.5 oauth2client==4.1.3 oauthlib==3.1.1 opencv-python==4.5.2.54 opt-einsum==3.3.0 packaging==20.9 pamqp==2.3.0 pandas==1.2.5 Pillow==8.4.0 prompt-toolkit==2.0.10 protobuf==3.19.1 psycopg2-binary==2.9.1 pyasn1==0.4.8 pyasn1-modules==0.2.8 PyAudio @ file:///C:/Python39/PyAudio-0.2.11-cp38-cp38-win_amd64.whl PyAutoGUI==0.9.53 pycparser==2.21 pydot==1.4.2 PyGetWindow==0.0.9 PyJWT==2.0.0 pykwalify==1.8.0 pymongo==3.10.1 PyMsgBox==1.0.9 pyparsing==2.4.7 pyperclip==1.8.2 pypiwin32==223 pyreadline3==3.3 PyRect==0.1.4 pyrsistent==0.18.0 PyScreeze==0.1.27 pyTelegramBotAPI==3.8.3 python-crfsuite==0.9.7 python-dateutil==2.8.2 python-engineio==4.3.0 python-socketio==5.4.1 pyttsx3==2.90 PyTweening==1.0.3 pytz==2021.3 PyWavelets==1.1.1 pywhatkit==5.1 pywin32==301 PyYAML==5.1 questionary==1.9.0 rasa==2.8.12 rasa-sdk==2.8.2 redis==3.5.3 regex==2021.7.6 requests==2.25.1 requests-oauthlib==1.3.0 requests-toolbelt==0.9.1 rfc3986==1.5.0 rocketchat-API==1.16.0 rsa==4.7.2 ruamel.yaml==0.16.13 ruamel.yaml.clib==0.2.6 s3transfer==0.5.0 sanic==20.9.1 Sanic-Cors==0.10.0.post3 sanic-jwt==1.6.0 Sanic-Plugins-Framework==0.9.5 scikit-image==0.18.3 scikit-learn==0.24.2 scipy==1.7.1 segmentation-models==1.0.1 sentry-sdk==1.2.0 six==1.15.0 sklearn-crfsuite==0.3.6 slackclient==2.9.3 sniffio==1.2.0 soupsieve==2.2.1 SpeechRecognition==3.8.1 SQLAlchemy==1.4.26 tabulate==0.8.9 tarsafe==0.0.3 tensorboard==2.7.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.0 tensorflow==2.5.0 tensorflow-addons==0.13.0 tensorflow-estimator==2.5.0 tensorflow-hub==0.12.0 tensorflow-probability==0.13.0 termcolor==1.1.0 terminaltables==3.1.0 threadpoolctl==3.0.0 tifffile==2021.10.12 torch @ file:///C:/python39/torch-1.10.0%2Bcpu-cp38-cp38-win_amd64.whl torchvision==0.2.1 tqdm==4.62.3 twilio==6.50.1 typeguard==2.13.0 typing-extensions==3.7.4.3 tzlocal==2.1 ujson==4.2.0 urllib3==1.26.6 virtualenv==20.4.7 wcwidth==0.2.5 webexteamssdk==1.6 websockets==8.1 Werkzeug==2.0.2 wikipedia==1.4.0 wrapt==1.12.1 yarl==1.7.2

Could you please tell me how can I resolve this error as soon as possible? I shall be highly thankful to you.

@Akshat_Vashisht share rasa --version

Rasa Version : 2.8.12 Minimum Compatible Version: 2.8.9 Rasa SDK Version : 2.8.2 Rasa X Version : None Python Version : 3.8.3 Operating System : Windows-10-10.0.19041-SP0 Python Path : C:\Python39\python.exe

@Akshat_Vashisht confirm me is that you created the conda environment of python to install rasa ?

Yes I have created the virtual environment to install rasa

@Akshat_Vashisht please share rasa --version screenshot whilst activating the environment.

Always tag with @ and nik202 for fast reply.

ss1 @nik202 ik202

@Akshat_Vashisht your Anaconda path is not right and its also not showing the env on the python path, that the issue I guess.

@Akshat_Vashisht the path should be something like this:

Python Path: c:\user\ (your name)\appdata\local\continum\anaconda3\env\rasa_demo\python.exe

I will recommend, delete the anaconda and re-install rasa with the recommended path, don’t change it the original path. Do let me know please.

could you please tell the path where I need to install rasa in my system. @nik202

INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking Using cached multidict-4.5.0.tar.gz (105 kB) @nik202

The output has stuck their now what should I do?

@Akshat_Vashisht sorry for the late reply, please downgrade the pip version to 20.2 and follow this thread Error running rasa x - <Future at 0x2b5686c4400 state=finished raised gaierror> on Windows - #6 by nik202

Ok

@Akshat_Vashisht are you able to solve this?

Sorry for late response.

Your solution has worked successfully, I have succesfully installed Rasa on my system using pip20.2

Thank you so much @nik202. I am highly obliged to you. You solved my 1week tension. Thank u, thank u so much

Yes

@Akshat_Vashisht Its ok, any time. I’d request to please close this thread for other readers and for your reference.

Valuable links and resources for your reference

  1. RasaMasterclass
  2. Conversational AI with Rasa - Video Series [Latest]
  3. Rasa for Beginners
  4. Rasa Certification Workshop
  5. Rasa Advanced Deployment Workshop
  6. Rasa Youtube Channel Please subscribe and hit the bell icon for notification.
  7. Rasa Github Mini Project
  8. Rasa Masterclass Handbook
  9. Hardcopy Book : Conversational AI with Rasa

I hope these links will help you to learn Rasa!