Error : This event loop is already running

I run rasa shell and I get the output below. I can type stuff in but when I press return the command line freezes.

I have installed rasa as per the page Installation. I am using Python 3.7 (after spending a lot of time trying to get it working with Python)

PS C:\Program Files\rasa> rasa shell --debug 2020-01-27 11:46:10 DEBUG rasa.model - Extracted model to ‘C:\Users*\AppData\Local\Temp\tmp24afqksa’. 2020-01-27 11:46:10 DEBUG rasa.cli.utils - Parameter ‘endpoints’ not set. Using default location ‘endpoints.yml’ instead. 2020-01-27 11:46:10 DEBUG rasa.cli.utils - Parameter ‘credentials’ not set. Using default location ‘credentials.yml’ instead. 2020-01-27 11:46:10 DEBUG rasa.model - Extracted model to 'C:\Users*\AppData\Local\Temp\tmpucaow731’. 2020-01-27 11:46:12 INFO root - Connecting to channel ‘cmdline’ which was specified by the ‘–connector’ argument. Any other channels will be ignored. To connect to all given channels, omit the ‘–connector’ argument. 2020-01-27 11:46:12 DEBUG sanic.root - CORS: Configuring CORS with resources: {’/’: {‘origins’: [’’], ‘methods’: ‘DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT’, ‘allow_headers’: [’.’], ‘expose_headers’: None, ‘supports_credentials’: True, ‘max_age’: None, ‘send_wildcard’: False, ‘automatic_options’: True, ‘vary_header’: True, ‘resources’: {’/’: {‘origins’: ‘’}}, ‘intercept_exceptions’: True, ‘always_send’: True}} 2020-01-27 11:46:12 DEBUG rasa.core.utils - Available web server routes: /webhooks/rest GET custom_webhook_CmdlineInput.health /webhooks/rest/webhook POST custom_webhook_CmdlineInput.receive / GET hello 2020-01-27 11:46:12 INFO root - Starting Rasa server on http://localhost:5005 2020-01-27 11:46:12 DEBUG rasa.core.utils - Using the default number of Sanic workers (1). 2020-01-27 11:46:12 INFO root - Enabling coroutine debugging. Loop id 1904835644936. 2020-01-27 11:46:12 DEBUG rasa.model - Extracted model to ‘C:\Users*\AppData\Local\Temp\tmpwt9rwrqm’. 2020-01-27 11:46:20 INFO absl - Entry Point [tensor2tensor.envs.tic_tac_toe_env:TicTacToeEnv] registered with id [T2TEnv-TicTacToeEnv-v0] 2020-01-27 11:46:22 DEBUG rasa.core.tracker_store - Connected to InMemoryTrackerStore. 2020-01-27 11:46:22 DEBUG rasa.core.lock_store - Connected to lock store ‘InMemoryLockStore’. 2020-01-27 11:46:22 DEBUG rasa.model - Extracted model to 'C:\Users*\AppData\Local\Temp\tmpcttohyl3’. 2020-01-27 11:46:22 DEBUG pykwalify.compat - Using yaml library: c:\users*****\appdata\local\programs\python\python37\lib\site-packages\ruamel\yaml_init_.py 2020-01-27 11:46:24 DEBUG rasa.core.nlg.generator - Instantiated NLG to ‘TemplatedNaturalLanguageGenerator’. Bot loaded. Type a message and press enter (use ‘/stop’ to exit): 2020-01-27 11:46:24 ERROR asyncio - Task exception was never retrieved future: <Task finished coro=<configure_app..run_cmdline_io() done, defined at c:\users******\appdata\local\programs\python\python37\lib\site-packages\rasa\core\run.py:124> exception=RuntimeError(‘This event loop is already running’)> Traceback (most recent call last): File “c:\users*\appdata\local\programs\python\python37\lib\site-packages\rasa\core\run.py", line 128, in run_cmdline_io server_url=constants.DEFAULT_SERVER_FORMAT.format(“http”, port) File "c:\users*\appdata\local\programs\python\python37\lib\site-packages\rasa\core\channels\console.py”, line 131, in record_messages text = get_user_input(button_question) File “c:\users*\appdata\local\programs\python\python37\lib\site-packages\rasa\core\channels\console.py", line 77, in get_user_input style=Style([(“qmark”, “#b373d6”), ("", “#b373d6”)]), File "c:\users*\appdata\local\programs\python\python37\lib\site-packages\questionary\question.py”, line 45, in ask return self.unsafe_ask(patch_stdout) File “c:\users*\appdata\local\programs\python\python37\lib\site-packages\questionary\question.py", line 59, in unsafe_ask return self.application.run() File "c:\users*\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\application\application.py”, line 810, in run return loop.run_until_complete(self.run_async(pre_run=pre_run)) File “c:\users*\appdata\local\programs\python\python37\lib\asyncio\base_events.py", line 570, in run_until_complete self.run_forever() File "c:\users*\appdata\local\programs\python\python37\lib\asyncio\base_events.py”, line 525, in run_forever raise RuntimeError(‘This event loop is already running’) RuntimeError: This event loop is already running Your input ->

4 Likes

I had “loop” issue when I run shell. I solved it by installing of next packages:

pip install google-auth==1.10.1 prompt-toolkit==2.0.10 questionary==1.4.0 SQLAlchemy==1.3.12 urllib3==1.25.7

Could you check it too?

10 Likes

Great. This was solved my issue and able to run rasa shell, Thanks.

1 Like

Thank you, this worked also for me on Windows 10 with python 3.7.6. Now I can run rasa shell.

Update: it was enough downgrading only questionary to ==1.4.0

6 Likes

This solved my issue.

Not sure why higher version of those libs are not supported when it gets installed through dependencies.

Downgrading it fixed the issue.

1 Like

Thanks

厉害 谢谢你

thanks man. This worked for me.

Try to upgrade to rasa 2.7

1 Like

running rasa 2.7.1 on ubuntu 20.04. Same error with rasa shell. Downgrading questionary to 1.4.0 solved problem.

My environment:

rasa --version

Rasa Version      :         2.8.2
Minimum Compatible Version: 2.8.0
Rasa SDK Version  :         2.8.2
Rasa X Version    :         0.42.0
Python Version    :         3.8.12
Operating System  :         Linux-4.15.0-106-generic-x86_64-with-glibc2.17
Python Path       :         /home/anhv/anaconda3/envs/lab_chatbot/bin/python

External Information

  • Operating System:: Ubuntu 18.04
  • sanic-jwt==1.6.0

which is not work with questionary==1.4.0

When I try to run pip install questionary==1.4.0, here is the error log

rasa 2.8.2 requires questionary<1.10.0,>=1.5.1, but you'll have questionary 1.4.0 which is incompatible.
rasa-x 0.42.0 requires questionary<1.6.0,>=1.5.1, but you'll have questionary 1.4.0 which is incompatible.

So I try to install question==1.5.1

pip install questionary==1.5.1

And It works. Hope it help

2 Likes

@rain1024 Thanks a lot Vu Anh for the updated feedback :slight_smile: for our readers.

1 Like