On window10, execute rasa x and report an error

my target:

build Chinese question answering robot

rasa version

Rasa Version : 2.8.0
Minimum Compatible Version: 2.8.0
Rasa SDK Version : 2.8.1
Rasa X Version : 0.42.0
Python Version : 3.7.7
Operating System : Windows-10-10.0.19041-SP0

command:rasa data validate

No story structure conflicts found.

command:

rasa x

error:

rasa.shared.exceptions.FileIOException: Failed to read file ‘C:\Users\cui\AppData\Local\Temp\tmpm7jti28x’, could not read the file using utf-8 to decode it. Please make sure the file is stored with this encoding.

Traceback:

File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasa\cli\x.py”, line 502, in run_locally domain_path=domain_path, File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\local.py”, line 242, in main project_path, data_path, session, args.port, config_path, domain_path File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\local.py”, line 169, in _initialize_with_local_data
domain_path=domain_path, File “D:\Python3.7.7\lib\asyncio\base_events.py”, line 587, in run_until_complete return future.result() File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\initialise.py”, line 382, in inject_files_from_disk
username, File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\initialise.py”, line 135, in inject_stories story_files, team, project_id, username File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\services\story_service.py”, line 568, in save_stories_from_files is_test=is_test, File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\services\story_service.py”, line 453, in save_stories
story_string, filename, domain, is_test File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\services\story_service.py”, line 381, in _extract_stories_yaml skip_validation=False, File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\services\story_service.py”, line 218, in get_story_steps reader, story_string, skip_validation=skip_validation File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasax\community\services\story_service.py”, line 135, in _reader_read_from_string return reader.read_from_file(temp_path, skip_validation=skip_validation) File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasa\shared\core\training_data\story_reader\yaml_story_reader.py”, line 101, in read_from_file filename, rasa.shared.utils.io.DEFAULT_ENCODING File “E:\pipenvs.venv\my_robot-0BFV8NyQ\lib\site-packages\rasa\shared\utils\io.py”, line 133, in read_file f"Failed to read file ‘{os.path.abspath(filename)}’, "
rasa.shared.exceptions.FileIOException: Failed to read file ‘C:\Users\cui\AppData\Local\Temp\tmpm7jti28x’, could not read the file using utf-8 to decode it. Please make sure the file is stored with this encoding.

@Dei6 Heya! Please follow these steps

I’d recommend to create a fresh conda environment with python 3.7 or 3.8 and follow the step

`pip install rasa==2.8.1`
`pip install rasa-sdk==2.8.1'

check version rasa --version its install or not

then

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. If you have any doubts please asked ok? I hope you created the environment??

I use pipenv environment with python 3.7。
Is it necessary to use conda environment?

@Dei6 Well, honestly I never used the pip environment, but it recommended by rasa to create the environment (I guess conda based environment) so please try the above mention steps and let us know.

The error described is attributable to Windows Python using (accidentally) the wrong encoding when reading the YAML files and pushing into the rasa oss API.

Set the environment variable PYTHONUTF=1 before starting rasa x to frace Python to use UTF8 even if it is not platform standard!

1 Like