wrapt: Installation can fail in Python3 in Windows due to UnicodeDecodeError
$ pip install wrapt
Will fail in Windows using a Visual Studio in some languages, because it will try to output some accented characters, and pip will fail with UnicodeDecodeError
to decode them properly, and wrapt will not be properly installed.
Exception:
Traceback (most recent call last):
File "c:\users\memsharded\envs\conan3\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 0xf3 in position 11: invalid continuation byte
The failure is in pip/compat/__init__.py
file:
if sys.version_info >= (3,):
def console_to_str(s):
try:
return s.decode(sys.__stdout__.encoding)
except UnicodeDecodeError:
return s.decode('utf_8')
I have just workarounded it with:
if sys.version_info >= (3,):
def console_to_str(s):
try:
return s.decode(sys.__stdout__.encoding)
except UnicodeDecodeError:
try:
return s.decode('utf_8')
except Exception as e:
return "Cannot decode this string"
It seems this will be improved in pip 10 (not yet released): https://github.com/pypa/pip/issues/4110#issuecomment-304476523
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 20 (5 by maintainers)
I also meet this issue. I guess it’s caused by Windows console encode fomat - GBK default. I rounded it by running
pip install wrapt
underGit Bash for Windows(MSYS, MinGW) console
, which encode format is UTF-8 default. Then everything is fine.Please. need patch there! 😃
have fresh python install 3.6.3 on my windows 10 and got the same error trying to use pylint plugin on IDE visual code , editor try to autoinstall on my new virtualenv pylint using python.exe for env
and then…
SOLVED
ty to : @GrahamDumpleton , @esabouraud
Just was a problem with symlinks from combination of windows10+gitSCM tools , just open Git Bash prompt and install it !
To solve this, change you code page to 866
chcp 866
It’s been out of beta since mid-April. We’re actually a few days away from our next release. 😃
Oh, my bad, I have just checked my recent py3.6 and it comes with pip 10 now by default, I hadn’t realize it. This is good news! Sorry for the noise.
I did fresh installs of python 3.6.3 on Windows 7 and Windows 10, and had this issue occur only on Windows 10.
Changing the codepage with chcp did not solve the issue for me. However running pip from “Git Bash” as @9468305 suggested did the trick.
@netzulo From what I understand of this issue, it is ultimately a problem in
pip
. Try the workaround above. Unless someone can point me to what in thewrapt
package might be triggering it, there isn’t much I can do.