Skip to content
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

UnicodeDecodeError from setup.py #73

Closed
mikstr opened this issue Aug 5, 2018 · 6 comments
Closed

UnicodeDecodeError from setup.py #73

mikstr opened this issue Aug 5, 2018 · 6 comments

Comments

@mikstr
Copy link

mikstr commented Aug 5, 2018

probably my setup, but happens on both my macbook and linux desktop at work (both with python 3)

p setup.py install --prefix=/Users/strange/qmlcode
MKL-discover: MKLROOT was not set
Traceback (most recent call last):
File "setup.py", line 170, in
setup_pepytools()
File "setup.py", line 149, in setup_pepytools
long_description = readme(),
File "setup.py", line 134, in readme
return f.read()
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]

Following seems to fix it:

diff --git a/setup.py b/setup.py
index 495f7e8..2ce0397 100755
--- a/setup.py
+++ b/setup.py
@@ -130,7 +130,7 @@ ext_fslatm = Extension(name = 'fslatm',
 
 # use README.md as long description
 def readme():
-    with open('README.md') as f:
+    with open('README.md', encoding='latin1') as f:
         return f.read()
@larsbratholm
Copy link
Collaborator

larsbratholm commented Aug 5, 2018

Just to debug a little. Can you tell me the output of

python
>>> import sys
>>> sys.stdout.encoding

also see if any of these environmental variables are set:

echo $LANGUAGE
echo $LC_ALL
echo $LANG
echo $LC_TYPE

And finally check if the following fixes the issue:

export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8

@larsbratholm
Copy link
Collaborator

@andersx @charnley @SilviaAmAm I don't see a reason not to hardcode the encoding in the setup. I'm just concerned that using the wrong encoding might break some of the functionality of the file reader classes.
@mikstr Can you try to run pytest in the test folder with your proposed fix and make sure that all tests passes? Also can you try to checkout the development branch and see if that solves the problem since I removed special characters like ü in the readme.

@mikstr
Copy link
Author

mikstr commented Aug 6, 2018

thanks @larsbratholm, I'll take a look at it this evening!

@andersx
Copy link
Member

andersx commented Aug 6, 2018

Thanks for the report! Does this also happen if you install directly from PyPI (e.g. pip install qml)?

If that's the case we need to push a bug fix to master and PyPI.

@mikstr
Copy link
Author

mikstr commented Aug 6, 2018

@andersx installation fails with pip3 install qml, works with pip2 install qml

the env variables req by @larsbratholm on my mac:

[qml]# echo $LANGUAGE

[qml]# echo $LC_ALL
C
[qml]# echo $LANG

[qml]# echo $LC_TYPE

If I set the above variables to en_US.UTF-8 as suggested by @larsbratholm installation works with both pip2 and pip3 :-)

@larsbratholm
Copy link
Collaborator

@mikstr Made a hotfix that removes the characters that causes trouble, so when that is accepted everything should work fine. To expand on this LC_ALL=C together with non-ascii characters like ü is what broke everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants