question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip issues UnicodeDecodeError on Windows 10 for Russian language

See original GitHub issue
  • Pip version: 9.0.1
  • Python version: 3.6.0
  • Operating system: Microsoft Windows 10 Home Edition [Version 10.0.10586] for Russian language

Description:

pip issues UnicodeDecodeError on byte 0x8d in Windows 10 for Russian language. It is not a problem for Windows 7 Ultimate SP1 for English language. Probably has something to do with default CMD encoding, please fix it.

What I’ve run:

C:\WINDOWS\system32>pip install pyyaml
Collecting pyyaml
  Using cached PyYAML-3.12.tar.gz
Building wheels for collected packages: pyyaml
  Running setup.py bdist_wheel for pyyaml ... error
  Failed building wheel for pyyaml
  Running setup.py clean for pyyaml
Failed to build pyyaml
Installing collected packages: pyyaml
  Running setup.py install for pyyaml ... error
Exception:
Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8d in position 68: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8d in position 68: invalid start byte

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

78reactions
robinxbcommented, Feb 11, 2017

Add a solution here: run a new cmd.exe console chcp it will show the system default code, for example 936. open Lib/site-package/pip/compat/__init__.py around 75 line, change return s.decode('utf_8') to return s.decode('cp936')

It’s just a workaround. I think pip might need solve this issue asap, it’s not easy to find solution.

This may have a general solution using cdll. Not sure if this is the best solution on windows but I still made a PR for this issue.

20reactions
xtipackocommented, Jan 24, 2017

I thought pip is suposed to be easy for users, is it possible to hide this problems from us ?😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

yet another encoding issue. Windows 8.1, both latest pythons ...
I run python get-pip.py from command prompt - this installed the pip correctly. I had it from here. Afterwards I run pip install...
Read more >
codecs — Codec registry and base classes — Python 3.11.1 ...
Looks up the codec info in the Python codec registry and returns a CodecInfo ... On encoding, use hexadecimal form of Unicode code...
Read more >
UnicodeDecodeError in mimetypes.py (#2377) · Issues · PyPy / pypy ...
Created originally on Bitbucket by Tiberiumk (Tiberium) Using last version of PyPy on Windows (5.3.1), issuing a "pypy -m ensurepip" command...
Read more >
Unicode and UTF-8 Output Text Buffer - Windows Command ...
In this post, we'll discuss the improvements we've been making to the Windows Console's internal text buffer, enabling it to better store ...
Read more >
Russian charecters are not displayed correctly in sqlci with ...
Hello! I am trying to use sqlcl, but get problems with Russian symbols. ... So on windows 10 computer I set UTF8 codepage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found