Search code examples
pythonunicodebrowniepipx

How to resolve this UnicodeEncodeError while installing eth-brownie on Windows10 with pipx?


I tried to install eth-brownie on a Windows 10 PC running anaconda python. Python version is 3.9x

I followed the instructions here;

https://eth-brownie.readthedocs.io/en/stable/install.html

I ran the command below;

$ pipx install eth-brownie

I received the error below.

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\users\user\appdata\roaming\python\python39\scripts\pipx.exe\__main__.py", line 7, in <module>
    return run_pipx_command(parsed_pipx_args)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pipx\main.py", line 202, in run_pipx_command
    return commands.install(
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pipx\commands\install.py", line 60, in install
    venv.install_package(
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pipx\venv.py", line 238, in install_package
    subprocess_post_check_handle_pip_error(pip_process)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pipx\util.py", line 349, in subprocess_post_check_handle_pip_error
    print(completed_process.stderr, file=pip_error_fh, end="")
  File "C:\ProgramData\Anaconda3\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 '\u2502' in position 104: character maps to <undefined>

Solution

  • According to this bug report on pipx's GitHub page, this was fixed in #811.

    The steps below should solve your problem:

    1. Install cython via the command

       pip install cython
      
    2. Run the command to install the package:

       pipx install eth-brownie
      

    If the above doesn't work, try directly using pip to install the package:

    pip install eth-brownie