# RASA bots

**URL:** <https://forum.rasa.com/t/rasa-bots/13382>\
**Category:** Rasa Open Source\
**Created:** [July 23, 2019, 8:01am UTC](https://forum.rasa.com/t/rasa-bots/13382 "2019-07-23T08:01:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashish](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ashish](https://forum.rasa.com/u/ashish)\
**Post date:** [July 23, 2019, 8:01am UTC](https://forum.rasa.com/t/rasa-bots/13382/1 "2019-07-23T08:01:09Z")

</div>

from rasa\_core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy

from rasa\_core.agent import Agent

import asyncio

agent = Agent(‘domain.yml’, policies=[MemoizationPolicy(), KerasPolicy(epochs=200)])

loop = asyncio.get\_event\_loop()

training\_data =loop.run\_until\_complete(agent.load\_data(‘stories.md’))

agent.train(

training\_data,

validation\_split=0.0

)

agent.persist(‘models/dialogue’)

ERROR:

RuntimeError: This event loop is already running

---

<div class="post-metadata">

**Author:** ![Tobias\_Wochinger](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tobias_wochinger/32/4580_2.png) [@Tobias\_Wochinger](https://forum.rasa.com/u/Tobias_Wochinger)\
**Post date:** [July 23, 2019, 4:03pm UTC](https://forum.rasa.com/t/rasa-bots/13382/2 "2019-07-23T16:03:38Z")

</div>

Can you please format your question?

---

<div class="post-metadata">

**Author:** ![ashish](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ashish](https://forum.rasa.com/u/ashish)\
**Post date:** [July 24, 2019, 9:53am UTC](https://forum.rasa.com/t/rasa-bots/13382/5 "2019-07-24T09:53:11Z")

</div>

Edited . Could be please suggest something to solve this?. I have tried all the suggestion .

---

<div class="post-metadata">

**Author:** ![Tobias\_Wochinger](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tobias_wochinger/32/4580_2.png) [@Tobias\_Wochinger](https://forum.rasa.com/u/Tobias_Wochinger)\
**Post date:** [July 24, 2019, 4:36pm UTC](https://forum.rasa.com/t/rasa-bots/13382/6 "2019-07-24T16:36:46Z")

</div>

- At which point does this exception happen?
- Is this the stack trace or you code?

---

<div class="post-metadata">

**Author:** ![ashish](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ashish](https://forum.rasa.com/u/ashish)\
**Post date:** [July 25, 2019, 5:32am UTC](https://forum.rasa.com/t/rasa-bots/13382/7 "2019-07-25T05:32:44Z")

</div>

[please check this code and suggest me what things i need to change. Its not working in my jupyter notebook . The training phase](https://github.com/santanu13/Weabot/blob/master/weabot.ipynb)

---

<div class="post-metadata">

**Author:** ![ashish](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ashish](https://forum.rasa.com/u/ashish)\
**Post date:** [July 25, 2019, 5:43am UTC](https://forum.rasa.com/t/rasa-bots/13382/9 "2019-07-25T05:43:39Z")

</div>

I have read many posts saying policy has been changed and when I updated policy then it was showing coroutines are not iterable then I used asyncio but then it was showing that this event loop is already running(see the first post) but I’m not able to solve this issue . Please suggest sample code or exact changes I need to do in this code.

rasa==1.1.7 rasa-sdk==1.1.0 python=3.6

---

<div class="post-metadata">

**Author:** ![ashish](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ashish](https://forum.rasa.com/u/ashish)\
**Post date:** [July 25, 2019, 6:12am UTC](https://forum.rasa.com/t/rasa-bots/13382/10 "2019-07-25T06:12:54Z")

</div>

RuntimeError Traceback (most recent call last) in 7 loop = asyncio.get\_event\_loop() 8 # loading our neatly defined training dialogues ----\> 9 training\_data = loop.run\_until\_complete(agent.load\_data(‘stories.md’)) 10 11

/usr/lib/python3.6/asyncio/base\_events.py in run\_until\_complete(self, future) 469 future.add\_done\_callback(\_run\_until\_complete\_cb) 470 try: –\> 471 self.run\_forever() 472 except: 473 if new\_task and future.done() and not future.cancelled():

/usr/lib/python3.6/asyncio/base\_events.py in run\_forever(self) 423 self.\_check\_closed() 424 if self.is\_running(): –\> 425 raise RuntimeError(‘This event loop is already running’) 426 if events.\_get\_running\_loop() is not None: 427 raise RuntimeError(

RuntimeError: This event loop is already running

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [July 25, 2019, 9:44am UTC](https://forum.rasa.com/t/rasa-bots/13382/11 "2019-07-25T09:44:25Z")

</div>

Hi @ashish, are you running in a jupyter notebook? if so please follow the beginning instructions [here](https://rasa.com/docs/rasa/master/api/jupyter-notebooks/) to avoid the event loop problem

---

<div class="post-metadata">

**Author:** ![ashish](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ashish](https://forum.rasa.com/u/ashish)\
**Post date:** [July 25, 2019, 10:40am UTC](https://forum.rasa.com/t/rasa-bots/13382/12 "2019-07-25T10:40:01Z")

</div>

Yes , I am working in a jupyter notebook. from this instructions , I have to add only these lines .

import nest\_asyncio

nest\_asyncio.apply()

print(“Event loop ready.”)

Right? I am a beginner ,Anything I missed?

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [July 25, 2019, 12:48pm UTC](https://forum.rasa.com/t/rasa-bots/13382/13 "2019-07-25T12:48:53Z")

</div>

Well you have to `pip install nest_asyncio` in the environment before launching the notebook, or alternatively try to do it from within the notebook, i think `! pip install nest_asyncio` should do it.
