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

208 views Asked by At

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>
2

There are 2 answers

0
Red On BEST ANSWER

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
0
guagay_wk On

I encountered the same error and use the same system configuration. I am using a Windows 10 PC running anaconda python. Python version is 3.9x

Here are the steps I run to install brownie successfully;

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

To install pipx:

$ python3 -m pip install --user pipx

$ python3 -m pipx ensurepath

To install a newer version of pipx that fixes the error reported (see https://github.com/pypa/pipx/issues/819);

$ pip install -U git+https://github.com/pypa/pipx.git@main

After this stage, I encountered one more error -> Cannot open include file: 'io.h': No such file or directory

The solution was to install Windows 10 SDK.

The description of the fix can be found here; Cannot open include file: 'io.h': No such file or directory

Finally, eth-brownie can be installed successfully using the following command;

$ pipx install eth-brownie