- I'm using Python 3.5.0 on Windows 7 64-bit
- My user name and full computer name both contains Slavic character: ł
- Therefore this character is in some file paths and environmental variables
- EDIT: Normally my active code page is 852
I'm getting this error on my CMD while trying to install some packages (not every):
UnicodeDecodeError: 'charmap' codec can't decode byte 0x88 in position "some_number": character maps to <undefined>
Example for package lib2d:
C:\Python35\Scripts\lib2d-0.0.2> c:\python35\python.exe setup.py install
running install
running build
running build_py
running build_ext
building '_lib2d' extension
Traceback (most recent call last):
File "setup.py", line 51, in <module>
scripts=['scripts/premultiplyalpha.py']
File "c:\python35\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\python35\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python35\lib\distutils\command\install.py", line 539, in run
self.run_command('build')
File "c:\python35\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python35\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\python35\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python35\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "c:\python35\lib\distutils\command\build_ext.py", line 447, in build_extensions
self._build_extensions_serial()
File "c:\python35\lib\distutils\command\build_ext.py", line 472, in _build_extensions_serial
self.build_extension(ext)
File "c:\python35\lib\distutils\command\build_ext.py", line 532, in build_extension
depends=ext.depends)
File "c:\python35\lib\distutils\_msvccompiler.py", line 315, in compile
self.initialize()
File "c:\python35\lib\distutils\_msvccompiler.py", line 208, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\python35\lib\distutils\_msvccompiler.py", line 90, in _get_vc_env
universal_newlines=True,
File "c:\python35\lib\subprocess.py", line 629, in check_output
**kwargs).stdout
File "c:\python35\lib\subprocess.py", line 698, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "c:\python35\lib\subprocess.py", line 1055, in communicate
stdout = self.stdout.read()
File "c:\python35\lib\encodings\cp1250.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x88 in position 162: character maps to <undefined>
Similar error occurs with pip install lib2d
and for building wheels
pip
and wheels
are up-to-date
I've done some research and it shows:
1. byte 0x88
in code page 852 is: ł - LATIN SMALL LETTER L WITH STROKE
2. it was very unwise to use "nonstandard character" in user and computer name (I was young and inexperienced)
3. changing full computer name is bad idea because license issues and then other programs now working might stop working due to the confusing change
4. Python installer tries to interpret that character in code page 1250 where it's undefined
5. Python shouldn't be unfamiliar with cp852, but it's wrongly assuming CMD has cp1250
6. ł - LATIN SMALL LETTER L WITH STROKE
in cp1250 is byte 0xB3
7. it seems to be the only reason why building fails for me
8. other "nonstandard character users" may encounter the same problem because bytes: 0x81; 0x83; 0x90; 0x98;
are unassigned in cp1250 but are assigned in cp852; cp775; cp 437; and other
So, is there a way to solve this installing/building obstacle and how to do it?
Maybe I should change and/or add something to Pythons file codecs.py? - trying to guess
I've tried chcp 1250
in CMD but it produces another, this time different error (see example below).
Example for package lib2d:
C:\Python35\Scripts\lib2d-0.0.2> c:\python35\python.exe setup.py install
running install
running build
running build_py
running build_ext
building '_lib2d' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\src
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iinclude -Ic:\python35\include -Ic:\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /Tcsrc/anim.c /Fobuild\temp.win-amd64-3.5\Release\src/anim.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
anim.c
src/anim.c(1): fatal error C1083: Cannot open include file: 'lib2d.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2
Is solving this other error a simpler road, if it is then how to do it?