Question

I got fresh installed Windows 7 x64 Professional with Python 2.7 and pip. There was no errors during the installation, but when I'm trying to pip install xlrd in CMD i got next:

C:\Users\Владислав>pip install xlrd

Downloading/unpacking xlrd  
Running setup.py
(path:c:\users\4918~1\appdata\local\temp\pip_build_┬ырфшёырт\xlrd\setup.py) egg_info for package xlrd

Cleaning up... Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip\commands\install.py", line 274, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl e=self.bundle)
  File "C:\Python27\lib\site-packages\pip\req.py", line 1220, in prepare_files
    req_to_install.assert_source_matches_version()
  File "C:\Python27\lib\site-packages\pip\req.py", line 460, in assert_source_matches_version
    % (display_path(self.source_dir), version, self))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 55: ordinal  not in range(128)

Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\pip.exe\__main__.py", line 9, in <module>
  File "C:\Python27\lib\site-packages\pip\__init__.py", line 185, in main
    return command.main(cmd_args)
  File "C:\Python27\lib\site-packages\pip\basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 70: ordinal  not in range(128)

I guess the reason is cyrillic in windows user's name, but can do nothing with it. Is any good solution exist (with no creating new user or something like this)? Can't find the answer. Thank you!

No correct solution

OTHER TIPS

I don't work a lot with unicode (especially in my usernames), but it looks like you are correct that your username is throwing things off. The first exception is trying to format an ascii string with a path that includes your non-ascii username and it throws an exception. You can get the same result by doing the following in an interpreter:

print "%s" % (u"Users\Владислав",)

I did a little googling and think you might get some help from this question/answer: Trouble with pip install selenium

The main point being that your OS or terminal might be set to 'ascii' as the default encoding. The solution may involve editing your Windows registry so be careful. As another note, you can check your default encoding in python by doing:

import sys
sys.getdefaultencoding()

Edit

I'm not on my Windows machine right now so I'm not sure where this should be set, but one of the referenced answers said:

It looked like a locale issue on my OS. Had to overwrite the global LANG environment variable to LANG="en_US.UTF-8".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top