Error while following guide to migrate from Rasa Open Source to Rasa-X

Hi all!

I was following the instructions on this link: How to Migrate Your Assistant to Rasa X (the Easy Way) | The Rasa Blog | Rasa

After following the instructions pointed at section " On the Rasa Open Source server: Forward events", when I try to run my Rasa bot using rasa shell, I get a series of errors when I send my first message, such as “aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:5005 ssl:default [The remote computer refused the network connection]”. What could be causing this? I’m running the action server as well, and am using Multipass in order to run Rasa X.

@luisfilipels Can you please elaborate your error and even share the screenshot and please tell what step are you using for the same?

Ok, I’ll do my best to elaborate :sweat_smile:

I have so far managed to install Rasa X onto a Multipass Ubuntu instance, and it appears to be working correctly, as I can reach the Rasa X GUI on my web browser. I also have a Rasa Open Source bot running on my Windows laptop (same laptop on which Multipass is running). I have exposed the RabittMQ port by following the instructions given on the link I posted on my original post, having also updated my endpoints.yml accordingly.

The problem starts when I run “rasa shell” and send a message to my bot. After a few seconds of waiting, I get the following:

2021-09-16 11:12:13 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished name='Task-2' coro=<configure_app.<locals>.run_cmdline_io() done, defined at c:\tools\anaconda3\envs\rasa\lib\site-packages\rasa\core\run.py
:131> exception=ClientConnectorError(ConnectionKey(host='localhost', port=5005, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), Conn
ectionRefusedError(22, 'The remote computer refused the network connection', None, 1225, None))>
Traceback (most recent call last):
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\connector.py", line 969, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "c:\tools\anaconda3\envs\rasa\lib\asyncio\base_events.py", line 1025, in create_connection
    raise exceptions[0]
  File "c:\tools\anaconda3\envs\rasa\lib\asyncio\base_events.py", line 1010, in create_connection
    sock = await self._connect_sock(
  File "c:\tools\anaconda3\envs\rasa\lib\asyncio\base_events.py", line 924, in _connect_sock
    await self.sock_connect(sock, address)
  File "c:\tools\anaconda3\envs\rasa\lib\asyncio\proactor_events.py", line 702, in sock_connect
    return await self._proactor.connect(sock, address)
  File "c:\tools\anaconda3\envs\rasa\lib\asyncio\windows_events.py", line 812, in _poll
    value = callback(transferred, key, ov)
  File "c:\tools\anaconda3\envs\rasa\lib\asyncio\windows_events.py", line 599, in finish_connect
    ov.getresult()
ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\rasa\core\run.py", line 135, in run_cmdline_io
    await console.record_messages(
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\rasa\core\channels\console.py", line 182, in record_messages
    async for response in bot_responses:
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\rasa\core\channels\console.py", line 135, in _send_message_receive_stream
    async with session.post(url, json=payload, raise_for_status=True) as resp:
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\client.py", line 520, in _request
    conn = await self._connector.connect(
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "c:\tools\anaconda3\envs\rasa\lib\site-packages\aiohttp\connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:5005 ssl:default [The remote computer refused the network connection]
Experienced exception while trying to serve

@luisfilipels can you please share rasa version using command rasa --version

Rasa Version      :         2.8.0
Minimum Compatible Version: 2.8.0
Rasa SDK Version  :         2.8.1
Rasa X Version    :         None
Python Version    :         3.8.10
Operating System  :         Windows-10-10.0.19041-SP0
Python Path       :         c:\tools\anaconda3\envs\rasa\python.exe

@luisfilipels you said “I have so far managed to install Rasa X onto a Multipass Ubuntu instance” but as per rasa --version its showing None? anything I am missing?

Sorry, I thought you were talking about the Rasa version on my host machine, not in the VM. I don’t have Rasa X running on Windows. I have it running on my Ubuntu instance by using the quick install script (curl -s get-rasa-x.rasa.com | sudo bash). Should I have it installed on Windows even though I used the quick install script?

@luisfilipels No worries, if you are working on rasa open source over period of time and now you decided to migrate to rasa x, you only need to install rasa x in your environment.

Please follow these steps:

pip install rasa-x==0.39.3 --extra-index-url https://pypi.rasa.com/simple

check rasa version rasa --version its install or not

You will see some error : ImportError: cannot import name ‘RowProxy’ from ‘sqlalchemy.engine’ Install

pip install SQLAlchemy==1.3.22 should fix it

If sanic related error: pip install sanic-jwt==1.6.0

delete .db if is showing alembic issue.

Good luck! I hope this will solve your issue.

Ok, I’ll try running it on Windows to see what happens! I’ll report back in this thread in case I find some issue. Thank you!

@luisfilipels I hope you solved this? Do you have any error or doubts? Just checking :wink:

Hi! As a matter of fact, I had a problem during installation of Rasa-X. After I ran pip:

Nevermind, I installed it using a venv I already had, and the installation ended with no problems. I’m going to try running it now!

@luisfilipels Did you followed the above suggestion? and you were able to install? Yes or No

Yes, I installed Rasa-X successfully. I’m gonna run it and see if it works. For reference, here’s the output of rasa --version:

Rasa Version      :         2.8.0
Minimum Compatible Version: 2.8.0
Rasa SDK Version  :         2.8.1
Rasa X Version    :         0.39.3
Python Version    :         3.8.10
Operating System  :         Windows-10-10.0.19041-SP0
Python Path       :         c:\tools\anaconda3\envs\rasa\python.exe

@luisfilipels Great :+1:. I’d request please close this thread as a solution for others and reference for yours. Good Luck!

@nik202 , I should run rasa x in the same directory as my existing bot, correct? In order to use rasa x with the bot I already have, that is.

@luisfilipels Yeps buddy! activate env > cd project >rasa x Just go for it :wink:

@nik202 , it worked! If only I had known it was this simple :sweat_smile:

Thank you very much for your help!