3

So I am trying to install eth-brownie via pipx as recommended, this on Windows. I tried everything also multiple re-installs of EVERYTHING including python. This one error just isn't fixable for me and googling this doesn't help.

PS C:\Users\XXXX\Desktop\solidity> python -m pipx install eth-brownie

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\XXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pipx\__main__.py", line 14, in <module>
    sys.exit(cli())
  File "C:\Users\XXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pipx\main.py", line 779, in cli
    return run_pipx_command(parsed_pipx_args)
  File "C:\Users\XXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pipx\main.py", line 202, in run_pipx_command
    return commands.install(
  File "C:\Users\XXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pipx\commands\install.py", line 60, in install
    venv.install_package(
  File "C:\Users\XXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pipx\venv.py", line 238, in install_package
    subprocess_post_check_handle_pip_error(pip_process)
  File "C:\Users\XXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\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 559: character maps to <undefined>

This last python install was via Microsoft store, don't ask me why, but this error is the same if I download python via the normal way.

If anyone can help me I would be very grateful. Works fine on my laptop, but it's an old and slow one so need it on PC.

JosefZ
  • 28,460
  • 5
  • 44
  • 83
  • You may need to make your terminal capable of handling unicode: see [here](https://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console) and [here](https://stackoverflow.com/questions/388490/how-to-use-unicode-characters-in-windows-command-line). – snakecharmerb Feb 10 '22 at 13:22
  • Hi Snakecharmerb, Thank you for your reply! However I did not get any further. I installed win-unicode-console via pip, but got the same error as before. Also tried exporting, editing & importing the file from registry but to no avail. Any more ideas are very welcome – pythonnoobsadly Feb 10 '22 at 15:20
  • I faced a similar error and managed to install eth-brownie successfully. A similar question was asked and I wrote my answer here https://stackoverflow.com/questions/71891172/how-to-resolve-this-unicodeencodeerror-while-installing-eth-brownie-on-windows10/71976218#71976218 – guagay_wk Apr 23 '22 at 02:04

4 Answers4

0

I'm pretty sure I just did it using pip instead of pipx:

python -m pip install eth-brownie

0

I had the same problem with python version 3.10.2 Downgraded python to version 3.9.2, installation of eth-brownie using pipx works fine.

Yeo
  • 41
  • 6
0

"UnicodeEncodeError" is not the real error. It is encoding error when the script was trying to print the real error.

To fix this fake error,

vi "C:\Users\XXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pipx\util.py"
change from
   with pip_error_file.open("w") as pip_error_fh:
to
   with pip_error_file.open("w", encoding="utf-8") as pip_error_fh:

Then run your install script again, and you will see the REAL error.

oldpride
  • 761
  • 7
  • 15
0

Best thing to do is uninstall the python3.10 pipx venvs installation of eth-brownie. Make sure you also already have python3.9 installed on your computer. Then reinstall eth-brownie using python3.9

pipx uninstall eth-brownie
python3.9 -m pip install --user pipx
python3.9 -m pipx ensurepath
python3.9 -m pipx install eth-brownie

to add libraries to your eth-brownie pipx venvs

python3.9 -m pipx inject eth-brownie playsound
Quy Bui
  • 679
  • 5
  • 5