-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip wheel fails with UnicodeDecodeError when setup.py and default encoding don't match #2042
Comments
Note this only happens when using Python 3. |
I'm also having trouble building wheels out of phue and python-nest using pip3. This is because their setup.py's are utf8. |
The offending code is at https://github.com/pypa/pip/blob/develop/pip/wheel.py#L687 |
Yes, but it's still not clear to me, why setup.py isn't run directly. Anybody have any insights on this? |
Since sdist install works, we could use the same trick used for sdist install: https://github.com/pypa/pip/blob/e42e822/pip/req/req_install.py#L478-L482 |
Because we want to use |
Also related to #1233 |
for all setup.py invocations bdist_wheel will now use tokenize in Python 3 just like for install fixes pypa#2042
@gumblex could you try #3265 (or https://github.com/xavfernandez/pip/tree/setuptool_shim) and confirm it is fixed ? |
It works. |
for all setup.py invocations bdist_wheel will now use tokenize in Python 3 just like for install fixes pypa#2042
When trying to build a wheel for a package, whose
setup.py
has a non-ascii encoding (even with proper encoding declaration), it fails with the following error:The offending code is calls to
read()
in the command to read and runsetup.py
. pip passes this to Python on the command line. In plain, unraveled code it would look like:The
fp.read()
call uses the system dependent default encoding (locale.getpreferredencoding()
), since theopen()
call didn't specify an encoding. Therefore the abovepip wheel
invocation failed on my Arm system, but not on my Linux x86_64 laptop.To fix this, pip would need to honor the source encoding declaration in
setup.py
, which is a rather complicated logic. Why does pip read & compile thesetup.py
file itself anyway? Could it not just callsubprocess.check_call([sys.executable, 'setup.py' 'bdist_wheel'])
?The text was updated successfully, but these errors were encountered: