Rasa initial project - Windows - Invalid Syntax

I am facing issue while running

rasa init --no-prompt

Error:

  File "d:\sw\64\envs\rasa35\lib\site-packages\mattermostwrapper\wrapper.py", line 89
    print(f"The post channel token is: {self.token}")
                                                   ^
SyntaxError: invalid syntax
  • Python version 3.5

  • rasa 1.3.8

         (rasa35) λ rasa init --no-prompt
      d:\sw\64\envs\rasa35\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_qint8 = np.dtype([("qint8", np.int8, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_qint16 = np.dtype([("qint16", np.int16, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_qint32 = np.dtype([("qint32", np.int32, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        np_resource = np.dtype([("resource", np.ubyte, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_qint8 = np.dtype([("qint8", np.int8, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_qint16 = np.dtype([("qint16", np.int16, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        _np_qint32 = np.dtype([("qint32", np.int32, 1)])
      d:\sw\64\envs\rasa35\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
        np_resource = np.dtype([("resource", np.ubyte, 1)])
      Welcome to Rasa! 🤖
    
      To get started quickly, an initial project will be created.
      If you need some help, check out the documentation at https://rasa.com/docs/rasa.
    
      Created project directory at 'D:\training\conda\rasa\first'.
      Finished creating project structure.
      Training an initial model...
      Training Core model...
      Traceback (most recent call last):
        File "d:\sw\64\envs\rasa35\lib\runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
        File "d:\sw\64\envs\rasa35\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
        File "D:\sw\64\envs\rasa35\Scripts\rasa.exe\__main__.py", line 7, in <module>
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\__main__.py", line 76, in main
      cmdline_arguments.func(cmdline_arguments)
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\cli\scaffold.py", line 195, in run
      init_project(args, path)
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\cli\scaffold.py", line 113, in init_project
      print_train_or_instructions(args, path)
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\cli\scaffold.py", line 50, in print_train_or_instructions
      args.model = rasa.train(domain, config, training_files, output)
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\train.py", line 40, in train
      kwargs=kwargs,
        File "d:\sw\64\envs\rasa35\lib\asyncio\base_events.py", line 467, in run_until_complete
      return future.result()
        File "d:\sw\64\envs\rasa35\lib\asyncio\futures.py", line 294, in result
      raise self._exception
        File "d:\sw\64\envs\rasa35\lib\asyncio\tasks.py", line 240, in _step
      result = coro.send(None)
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\train.py", line 91, in train_async
      kwargs,
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\train.py", line 175, in _train_async_internal
      kwargs=kwargs,
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\train.py", line 210, in _do_training
      kwargs=kwargs,
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\train.py", line 339, in _train_core_with_validated_data
      kwargs=kwargs,
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\core\train.py", line 32, in train
      from rasa.core.agent import Agent
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\core\agent.py", line 16, in <module>
      from rasa.core.channels.channel import InputChannel, OutputChannel, UserMessage
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\core\channels\__init__.py", line 21, in <module>
      from rasa.core.channels.mattermost import MattermostInput  # nopep8
        File "d:\sw\64\envs\rasa35\lib\site-packages\rasa\core\channels\mattermost.py", line 2, in <module>
      from mattermostwrapper import MattermostAPI
        File "d:\sw\64\envs\rasa35\lib\site-packages\mattermostwrapper\__init__.py", line 1, in <module>
      from .wrapper import MattermostAPI
        File "d:\sw\64\envs\rasa35\lib\site-packages\mattermostwrapper\wrapper.py", line 89
      print(f"The post channel token is: {self.token}")

Maybe you should try installing with another version of Python

@ayFortune Pyhton 3.6 / 3.7 throws error when trying to install rasa

ERROR: Could not find a version that satisfies the requirement tensorflow<2.2,>=2.1 (from rasa) (from versions: none)
ERROR: No matching distribution found for tensorflow<2.2,>=2.1 (from rasa)

This was the reason i went with 3.5 . Infact this StackOverflow thread mentions that tensorflow is compatible only with Python 3.5 on windows.

pip3 install rasa
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting rasa
  Using cached rasa-1.10.1-py3-none-any.whl (509 kB)
Collecting absl-py<0.10,>=0.9
  Using cached absl-py-0.9.0.tar.gz (104 kB)
Collecting multidict<5.0,>=4.6
  Using cached multidict-4.7.6-cp38-cp38-win32.whl (46 kB)
Collecting tqdm<4.46,>=4.31
  Using cached tqdm-4.45.0-py2.py3-none-any.whl (60 kB)
Collecting colorhash<1.1.0,>=1.0.2
  Using cached colorhash-1.0.2-py2.py3-none-any.whl (6.0 kB)
Collecting python-telegram-bot<13.0,>=11.1
  Using cached python_telegram_bot-12.7-py2.py3-none-any.whl (375 kB)
Collecting coloredlogs<11.0,>=10.0
  Using cached coloredlogs-10.0-py2.py3-none-any.whl (47 kB)
Collecting colorclass<2.3,>=2.2
  Using cached colorclass-2.2.0.tar.gz (17 kB)
Collecting tensorflow-estimator==2.1.0
  Using cached tensorflow_estimator-2.1.0-py2.py3-none-any.whl (448 kB)
Collecting rocketchat_API<1.4.0,>=0.6.31
  Using cached rocketchat_API-1.3.1-py3-none-any.whl (9.6 kB)
Collecting jsonpickle<1.5,>=1.3
  Using cached jsonpickle-1.4.1-py2.py3-none-any.whl (36 kB)
Collecting aiohttp<3.7,>=3.6
  Using cached aiohttp-3.6.2-py3-none-any.whl (441 kB)
Collecting kafka-python<2.0,>=1.4
  Using cached kafka_python-1.4.7-py2.py3-none-any.whl (266 kB)
Requirement already satisfied: numpy<2.0,>=1.16 in d:\sw\python\3.8\lib\site-packages (from rasa) (1.18.4)
Collecting twilio<6.27,>=6.26
  Using cached twilio-6.26.3-py2.py3-none-any.whl (979 kB)
Collecting python-engineio<3.13,>=3.11
  Using cached python_engineio-3.12.1-py2.py3-none-any.whl (49 kB)
ERROR: Could not find a version that satisfies the requirement tensorflow<2.2,>=2.1 (from rasa) (from versions: none)
ERROR: No matching distribution found for tensorflow<2.2,>=2.1 (from rasa)

I think creating an isolated environment with anaconda will work. Be specific when creating the environment, use python=3.6

So that when you’re using pip install rasa, it’ll sort out the tensor flow version itself. I hope it works for you.