Rasa init fails with UnicodeEncodeError: 'charmap' codec

hi, I am trying to install rasa on windows 10 platform. Below are my environment specifications.

Rasa Version      :         3.0.2
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.0.2
Rasa X Version    :         None
Python Version    :         3.8.0
Operating System  :         Windows-10-10.0.19041-SP0
PIP               :         21.3.1

pip install rasa worked without any errors. after that when I run “rasa init” , i am getting errors related to codec. Please let me know if I am missing something.

Traceback (most recent call last):
  File "c:\users\ap\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\ap\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\ap\AppData\Local\Programs\Python\Python38\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\rasa\__main__.py", line 121, in main
    cmdline_arguments.func(cmdline_arguments)
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\rasa\cli\scaffold.py", line 188, in run
    print_success("Welcome to Rasa! \U0001f916\n")
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\rasa\shared\utils\cli.py", line 21, in print_success
    print_color(*args, color=rasa.shared.utils.io.bcolors.OKGREEN)
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\rasa\shared\utils\cli.py", line 15, in print_color
    print(output, file=stream)
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\colorama\ansitowin32.py", line 41, in write
    self.__convertor.write(text)
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\colorama\ansitowin32.py", line 162, in write
    self.write_and_convert(text)
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\colorama\ansitowin32.py", line 187, in write_and_convert
    self.write_plain_text(text, cursor, start)
  File "c:\users\ap\appdata\local\programs\python\python38\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
    self.wrapped.write(text[start:end])
  File "c:\users\ap\appdata\local\programs\python\python38\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f916' in position 17: character maps to <undefined>

@anuravi can you please try this:

SET PYTHONIOENCODING=‘utf8’ OR PYTHONIOENCODING='utf8' rasa init

Please update me the progress, and I hope you will solve this issue.

1 Like

Thank you @nik202 . It is working now

@anuravi great! can I request to close this thread as a solution for others and for your reference. Thanks.