Rasa: Rasa Shell error following tutorial

Created on 28 Dec 2019  ·  13Comments  ·  Source: RasaHQ/rasa

Rasa Shell gives following error on input

Exception occurred while handling uri: 'http://localhost:5005/webhooks/rest/webhook?stream=true&token=' Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/sanic/app.py", line 946, in handle_request request, request_name=name TypeError: _run_request_middleware() got an unexpected keyword argument 'request_name' Exception occurred in one of response middleware handlers Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/sanic/app.py", line 1017, in handle_request request, response, request_name=name TypeError: _run_response_middleware() got an unexpected keyword argument 'request_name' 2019-12-28 05:06:15 ERROR asyncio - Task exception was never retrieved future: <Task finished coro=<configure_app.<locals>.run_cmdline_io() done, defined at /usr/local/lib/python3.6/dist-packages/rasa/core/run.py:124> exception=ClientResponseError(RequestInfo(url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token='), method='POST', headers=<CIMultiDictProxy('Host': 'localhost:5005', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.6 aiohttp/3.6.2', 'Content-Length': '41', 'Content-Type': 'application/json')>, real_url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token=')), (), status=500, message='Internal Server Error', headers=<CIMultiDictProxy('Connection': 'keep-alive', 'Keep-Alive': '5', 'Content-Length': '144', 'Content-Type': 'text/html; charset=utf-8')>)> Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/rasa/core/run.py", line 128, in run_cmdline_io server_url=constants.DEFAULT_SERVER_FORMAT.format("http", port) File "/usr/local/lib/python3.6/dist-packages/rasa/core/channels/console.py", line 140, in record_messages async for response in bot_responses: File "/usr/local/lib/python3.6/dist-packages/rasa/core/channels/console.py", line 104, in send_message_receive_stream async with session.post(url, json=payload, raise_for_status=True) as resp: File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 1012, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 588, in _request resp.raise_for_status() File "/usr/local/lib/python3.6/dist-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status headers=self.headers) aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token=')

Steps to reproduce

On Ubuntu 18.04 LTS as root

apt install python3-dev python3-pip

pip3 install -U pip

python3 --version

Python 3.6.9

pip --version

pip 19.3.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)

pip install rasa

Successfully installed ConfigArgParse-0.15.2 Jinja2-2.10.3 MarkupSafe-1.1.1 Pillow-6.2.1 PyJWT-1.7.1 SQLAlchemy-1.3.12 absl-py-0.9.0 aiofiles-0.4.0 aiohttp-3.6.2 apscheduler-3.6.3 astor-0.8.1 async-generator-1.10 async-timeout-3.0.1 attrs-19.3.0 boto3-1.10.45 botocore-1.13.45 bz2file-0.98 cachetools-4.0.0 cloudpickle-1.2.2 colorclass-2.2.0 coloredlogs-10.0 colorhash-1.0.2 contextvars-2.4 cycler-0.10.0 decorator-4.4.1 dill-0.3.1.1 dnspython-1.16.0 docopt-0.6.2 docutils-0.15.2 dopamine-rl-3.0.1 fbmessenger-6.0.0 flask-1.1.1 future-0.18.2 gast-0.2.2 gevent-1.4.0 gin-config-0.3.0 google-api-python-client-1.7.11 google-auth-1.10.0 google-auth-httplib2-0.0.3 google-pasta-0.1.8 googleapis-common-protos-1.6.0 greenlet-0.4.15 grpcio-1.26.0 gunicorn-20.0.4 gym-0.15.4 h11-0.8.1 h2-3.1.1 h5py-2.10.0 hpack-3.0.0 hstspreload-2019.12.25 httptools-0.0.13 httpx-0.9.3 humanfriendly-4.18 hyperframe-5.2.0 idna-ssl-1.1.0 immutables-0.11 importlib-metadata-1.3.0 itsdangerous-1.1.0 jmespath-0.9.4 jsonpickle-1.2 jsonschema-3.2.0 keras-applications-1.0.8 keras-preprocessing-1.1.0 kfac-0.2.0 kiwisolver-1.1.0 markdown-3.1.1 matplotlib-3.1.2 mattermostwrapper-2.1 mesh-tensorflow-0.1.7 more-itertools-8.0.2 mpmath-1.1.0 multidict-4.6.1 networkx-2.3 numpy-1.18.0 oauth2client-4.1.3 opencv-python-4.1.2.30 opt-einsum-3.1.0 packaging-19.2 pika-1.0.1 promise-2.3 prompt-toolkit-2.0.10 protobuf-3.11.2 pydot-1.4.1 pyglet-1.3.2 pykwalify-1.7.0 pymongo-3.10.0 pyparsing-2.4.6 pypng-0.0.20 pyrsistent-0.15.6 python-crfsuite-0.9.6 python-dateutil-2.8.1 python-engineio-3.11.1 python-socketio-4.4.0 python-telegram-bot-11.1.0 pytz-2019.3 questionary-1.4.0 rasa-1.6.0 rasa-sdk-1.6.0 redis-3.3.11 requests-2.22.0 requests-toolbelt-0.9.1 rfc3986-1.3.2 rocketchat-API-0.6.36 rsa-4.0 ruamel.yaml-0.15.100 s3transfer-0.2.1 sanic-19.12.0 sanic-cors-0.9.9.post1 sanic-jwt-1.3.2 sanic-plugins-framework-0.8.2 scikit-learn-0.20.4 scipy-1.4.1 setuptools-42.0.2 sklearn-crfsuite-0.3.6 slackclient-1.3.2 sniffio-1.1.0 sympy-1.5 tabulate-0.8.6 tensor2tensor-1.14.1 tensorboard-1.15.0 tensorflow-1.15.0 tensorflow-datasets-1.3.2 tensorflow-estimator-1.15.1 tensorflow-gan-2.0.0 tensorflow-hub-0.7.0 tensorflow-metadata-0.15.2 tensorflow-probability-0.7.0 termcolor-1.1.0 terminaltables-3.1.0 tqdm-4.41.0 twilio-6.35.1 typing-extensions-3.7.4.1 tzlocal-2.0.0 ujson-1.35 uritemplate-3.0.1 uvloop-0.14.0 wcwidth-0.1.7 webexteamssdk-1.2 websocket-client-0.54.0 websockets-8.1 werkzeug-0.16.0 wrapt-1.11.2 yarl-1.4.2 zipp-0.6.0

rasa init --no-prompt

NLU model training completed.
Your Rasa model is trained and saved at '/root/bots/models/20191228-051836.tar.gz'.
If you want to speak to the assistant, run 'rasa shell' at any time inside the project directory.

rasa shell

$ 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.
$ root - Starting Rasa server on http://localhost:5005
$ absl - Entry Point [tensor2tensor.envs.tic_tac_toe_env:TicTacToeEnv] registered with id [T2TEnv-TicTacToeEnv-v0]
$: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
Bot loaded. Type a message and press enter (use '/stop' to exit):
Your input ->

hello

Exception occurred while handling uri: 'http://localhost:5005/webhooks/rest/webhook?stream=true&token='
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sanic/app.py", line 946, in handle_request
request, request_name=name
TypeError: _run_request_middleware() got an unexpected keyword argument 'request_name'
Exception occurred in one of response middleware handlers
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sanic/app.py", line 1017, in handle_request
request, response, request_name=name
TypeError: _run_response_middleware() got an unexpected keyword argument 'request_name'
2019-12-28 05:06:15 ERROR asyncio - Task exception was never retrieved
future: .run_cmdline_io() done, defined at /usr/local/lib/python3.6/dist-packages/rasa/core/run.py:124> exception=ClientResponseError(RequestInfo(url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token='), method='POST', headers= Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/rasa/core/run.py", line 128, in run_cmdline_io
server_url=constants.DEFAULT_SERVER_FORMAT.format("http", port)
File "/usr/local/lib/python3.6/dist-packages/rasa/core/channels/console.py", line 140, in record_messages
async for response in bot_responses:
File "/usr/local/lib/python3.6/dist-packages/rasa/core/channels/console.py", line 104, in send_message_receive_stream
async with session.post(url, json=payload, raise_for_status=True) as resp:
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 1012, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 588, in _request
resp.raise_for_status()
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token=')

Most helpful comment

I found a reason which is the version of sanic doesn't match requirements, and try to install sanic 19.9.0 fix this error.
pip install sanic==19.9.0

All 13 comments

I got the same error. Looking for an answer.

I found a reason which is the version of sanic doesn't match requirements, and try to install sanic 19.9.0 fix this error.
pip install sanic==19.9.0

@jxf1002 thanks for instructions how to fix it.

Thanks for raising this issue, @akelad will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗

From duplicate issue:

The latest version of Sanic v19.12.0 has introduced breaking changes and has broken the rest input channel. Please change the dependency for sanic back to 19.9.0.

@jxf1002 @Naktibalda can you confirm that it was v19.12.0 that introduced the breaking changes? does pip install sanic==19.11.0 work okay?

ya for me too sanic worked but the regular setup did not work.

I found a reason which is the version of sanic doesn't match requirements, and try to install sonic 19.9.0 fix this error.
pip install sanic==19.9.0

Thanks worked for me after a week of searching.

@erohmensing sanic doesn't have v19.11.0.
https://sanic.readthedocs.io/en/latest/sanic/changelog.html#

Collecting sanic==19.11.0
Could not find a version that satisfies the requirement sanic==19.11.0 (from versions: 0.1.0, 0.1.1, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.5.2, 0.5.4, 0.6.0, 0.7.0, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 18.12.0, 19.3.1, 19.6.0, 19.6.2, 19.6.3, 19.9.0, 19.12.0)
No matching distribution found for sanic==19.11.0

Oh, weird 🤔 perfect, we'll pinn 19.9.0, thanks for the help 👍

pip install sanic==19.9.0

Yes, this works. Thank you

Still does not work with sanic version 19.12.2, work around fixed it.

This version should be correctly pinned in rasa 1.6.1. 👍

Was this page helpful?
0 / 5 - 0 ratings