-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing packages fails if Python 3 installed into path with non-ASCII characters #9054
Comments
Can you try the same command with |
|
When writing The |
Could you try |
after installing wheel with pip it works.
P.S. It's on pip 20.2.4 |
Oh, awesome! So |
Yea, this is probably because of Python 3.9 being used, which won't have wheels available for most packages. |
I was working on a PR for this and got curious. The path we assumed caused the problem is actually encodable in the user’s code page, and I can write it without a problem: >>> p = r'C:\Users\ФШЪЙAUC'
>>> p.encode('cp1251')
b'C:\\Users\\\xd4\xd8\xda\xc9AUC'
>>> with open('test', 'w', encoding='cp1251') as f:
... f.write(r'c:\users\фшъйauc')
...
16 which makes me want to second guess whether we’re actually identifying the bug correctly. |
Looks like it affects Python 3.8.x (both classical installer and Microsoft Store one) too: |
Can this error closed by #9136 ? PR was closed because of py2 support, as mentioned in conversation, but now python 2 doesn't need support |
As noted on #9136 "feel free to submit a new PR". I don't honestly know if fixing that issue would fix this one, but the easiest way to find out would probably be to try (after all, any fix should include a test that demonstrates the problem and that the new code fixes it, so even just starting with a test case in test-driven style would be useful...) |
I set PYTHONUTF8=1 env variable as mentioned in #9573 and my problem (black hook in pre-commit raises UnicodeEncodeError) was solved. As I know, this is equivalent to open(..., encoding="utf-8"). I think this (set encoding in file open) can be solution but I don't know how to test this |
This issue should be fixed by #10593 |
Good spot! |
Environment
Description
A fresh installation of Python 3.9 can't install any libraries with pip if username contains non-ASCII characters.
Probably it affects any paths with non-ASCII characters.
This is not new and happened before multiple times across recent years. One of the latest examples is #4984. I kindly suggest adding a unittest for that error.
This is especially bad because Python is number one language for education now. And such errors can confuse children a lot - they are not developers and are likely to have both prerequisites for this bug: 1) username in native language 2) installing Python with default settings
Expected behavior
pip is expected to work
How to Reproduce
pip install pylint
Output
The text was updated successfully, but these errors were encountered: