UnicodeDecodeError when using the Python "reflex init" command

175 views Asked by At

I am trying to run the Python Reflex Framework on Windows 10, with a python version 3.10.5; I get an error when using the command "reflex init" (it should be mentioned that I use a virtual environment):

Traceback (most recent call last):
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\Scripts\reflex.exe\__main__.py", line 7, in <module>
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\typer\main.py", line 328, in __call__
    raise e
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\typer\main.py", line 311, in __call__
    return get_command(self)(*args, **kwargs)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\typer\core.py", line 778, in main
    return _main(
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\typer\core.py", line 216, in _main
    rv = self.invoke(ctx)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\typer\main.py", line 683, in wrapper
    return callback(**use_params)  # type: ignore
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\reflex.py", line 123, in init
    _init(name, template, loglevel)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\reflex.py", line 84, in _init
    prerequisites.initialize_frontend_dependencies()
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\utils\prerequisites.py", line 751, in initialize_frontend_dependencies
    processes.run_concurrently(install_node, install_bun)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\utils\processes.py", line 199, in run_concurrently
    with run_concurrently_context(*fns):
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 142, in __exit__
    next(self.gen)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\utils\processes.py", line 186, in run_concurrently_context
    task.result()
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 439, in result
    return self.__get_result()
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
    raise self._exception
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\utils\prerequisites.py", line 557, in install_node
    processes.show_status("Installing node", process)
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\utils\processes.py", line 256, in show_status
    for line in stream_logs(message, process):
  File "C:\Users\CHICHO\Desktop\reflexppp\.env\lib\site-packages\reflex\utils\processes.py", line 223, in stream_logs
    for line in process.stdout:
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 128: invalid start byte
1

There are 1 answers

0
AlexOAD On

Once I had this problem. I uninstalled the reflex library, deleted the virtual environment and then created it again. Now I'm using Poetry as project management, and I don't have any troubles as I had... I have Windows 10 too, but I'm using Python 3.11.0 version instead of 3.10 But I also have used Reflex with Python 3.10.8 with any problem..