-2

I am trying to continue with a Rasa chatbot that I have not used since September and I find a syntax problem with the dependency of Tensorflow. I do not know if this is due to the fact that there are updates to be made with my dependencies or if it due to the fact that I use python3.7 as suggested by people on GitHub, or some other reason.

(moo_env) C:\Users\antoi\Documents\Programming\projects\moodbot>py train_online.py
Traceback (most recent call last):
  File "train_online.py", line 37, in <module>
    nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/moodnlu')
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_core\interpreter.py", line 221, in __init__
    self._load_interpreter()
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_core\interpreter.py", line 237, in _load_interpreter
    self.interpreter = Interpreter.load(self.model_directory)
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\model.py", line 276, in load
    skip_validation)
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\model.py", line 298, in create
    components.validate_requirements(model_metadata.component_classes)
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\components.py", line 49, in validate_requirements
    from rasa_nlu import registry
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\registry.py", line 23, in <module>
    from rasa_nlu.classifiers.embedding_intent_classifier import \
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\classifiers\embedding_intent_classifier.py", line 32, in <module>
    import tensorflow as tf
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 114
    def TFE_ContextOptionsSetAsync(arg1, async):

SyntaxError: invalid syntax

You can find my code in Github repository

Revolucion for Monica
  • 2,848
  • 8
  • 39
  • 78

1 Answers1

0

The reason is this line in pywrap_tensorflow_internal.py:

def TFE_ContextOptionsSetAsync(arg1, async):

Since Python 3.5, async (and await) are keywords and can no longer be used as identifiers. I assume you use a very outdated version of tensorflow.

L3viathan
  • 26,748
  • 2
  • 58
  • 81
  • Thanks for your insights! I thought I had a pretty new version and I updated in any case with `pip3 install --upgrade tensorflow` but I still have the same error :/ – Revolucion for Monica Jan 07 '19 at 14:16
  • @ThePassenger What does `python3 -c 'import tensorflow as tf; print(tf.__version__)'` print? – L3viathan Jan 07 '19 at 14:21
  • The same error `SyntaxError: invalid syntax` on `def TFE_ContextOptionsSetAsync(arg1, async):` – Revolucion for Monica Jan 07 '19 at 14:25
  • Try completely removing tensorflow, _then try importing it despite your uninstallation_. Do you still get the same error, or an ImportError? If all else fails, edit that file to rename the `async` parameter to something else. – L3viathan Jan 07 '19 at 14:31
  • A `ModuleNotFoundError`. Maybe I should add that I use `py` rather than `python3` in the command line. – Revolucion for Monica Jan 07 '19 at 15:08