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.

Installing packages fails if Python 3 installed into path with non-ASCII characters

See original GitHub issue
  • Pip version: 9.0.1 (installed with Python 3.6.4)
  • Python version: 3.6.4
  • Operating system: Windows 7 and 10

Description:

Organizing training where using Python 3 for the first time. Two participants for failed to use pip for anything due to UnicodeDecodeError. After a little debugging it turned out this was due to to them having non-ASCII characters in their user name (not uncommon here in Finland) and Python 3.6 being installed under their account into a path like C:\Users\Käyttäjä\AppData\.... This was the default location offered by the Python installer.

Both users were using Windows 10, but I was able to reproduce this with my Window 7 virtual machine as well. Account with non-ASCII characters isn’t needed, it’s enough to install Python into any path with non-ASCII characters. A workaround was uninstalling Python and installing it directly under C:\.

What I’ve run:

C:\Users\peke>py -m pip --version
pip 9.0.1 from C:\Python36\lib\site-packages (python 3.6)
C:\Users\peke>py -m pip install robotframework
Collecting robotframework
  Using cached robotframework-3.0.2.tar.gz
Installing collected packages: robotframework
  Running setup.py install for robotframework ... error
Exception:
Traceback (most recent call last):
  File "C:\Users\peke\äää\Python36\lib\site-packages\pip\compat\__init__.py", li
ne 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 23: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\peke\äää\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\peke\äää\Python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Users\peke\äää\Python36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "C:\Users\peke\äää\Python36\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "C:\Users\peke\äää\Python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "C:\Users\peke\äää\Python36\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 0xe4 in position 23: invalid continuation byte

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
pradyunsgcommented, Jan 1, 2019

The fix has been released. 😃

The code needs a test though, which is what this issue is tracking.

1reaction
pfmoorecommented, Jan 23, 2018

Sorry - I hadn’t hunted down the PR that fixed this. It’s #4486.

Ideally, I’d like our Appveyor tests to run with a non-ASCII username, or possibly a non-latin-1 encoding, but I’ve no idea how we’d do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error with non-ASCII character? - Python Forum
Using 3.9.0 under Windows 10. I get an error with "pip install pyinstaller" as below (my username REDACTED in this excerpt):
Read more >
Pip install Unicode error when having non-ASCII characters in ...
Basically pip install can not install some packages on windows if you have non-ASCII characters in your user folder name (cyrillic in my ......
Read more >
Errors About Non-Ascii And Python Libraryies When Installing ...
Installing packages fails if Python 3 installed into path with nonASCII characters #4984. Open. pekkaklarck opened this issue on Jan 22.
Read more >
Unicode error from pip install - Stack Overflow
I am trying to install pyevolve module using pip with command: pip install pyevolve. And get an error "UnicodeDecodeError: 'ascii' codec ...
Read more >
Crashes when project path or path to Django install contains a ...
Refs #24324 -- Fixed crash in {% debug %} tag on Python 2. If Django is installed in a path that contains non-ASCII...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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