skimage-tutorials icon indicating copy to clipboard operation
skimage-tutorials copied to clipboard

Error check_setup.py

Open pyAstroDude opened this issue 6 years ago • 3 comments

When I run the check_setup.py I get the following error: Traceback (most recent call last): File "check_setup.py", line 41, in status, pkg.ljust(13), version_installed) UnicodeEncodeError: 'ascii' codec can't encode character '\u2713' in position 1: ordinal not in range(128)

Note that I am using a Mac OS X 10.13.6, with miniconda installation; conda version 4.7.5 and python version 3.6.8

pyAstroDude avatar Jul 03 '19 19:07 pyAstroDude

In the print statement I did status.encode("utf-8")

which got rid of the error but the output is messed up i.e. cannot print the check mark

here is my output: [b'\xe2\x9c\x93'] scikit-image 0.15.0 [b'\xe2\x9c\x93'] numpy 1.16.4 [b'\xe2\x9c\x93'] scipy 1.2.1 [b'\xe2\x9c\x93'] matplotlib 3.1.0 [b'\xe2\x9c\x93'] notebook 5.7.8 [b'X'] scikit-learn Not installed

pyAstroDude avatar Jul 03 '19 19:07 pyAstroDude

Hi @pyAstroDude, I can't reproduce the error (Ubuntu-ish Linux, Anaconda with conda version 4.7.10, Python version 3.7.3):

$ python check_setup.py 
[✓] scikit-image  0.16.dev0
[✓] numpy         1.16.4
[✓] scipy         1.3.0
[✓] matplotlib    3.1.0
[✓] notebook      6.0.0
[✓] scikit-learn  0.21.2

@scikit-image/core is there anyone with a Mac or a different Python distro that can reproduce this? Thanks!

alexdesiqueira avatar Jul 31 '19 22:07 alexdesiqueira

Can't reproduce on Arch-like Linux with miniconda (conda 4.7.10) and Python 3.6.9. @pyAstroDude, do you get the same behavior inside a brand-new conda environment maybe with Python 3.7?

status.encode("utf-8") actually encodes the string in bytes which you don't want. Could this error stem from the unicode support of your shell? Where does the error occur if your separate the print- and format statements into two separate statements? E.g.

s = '[{}] {:<11} {}'.format(status, pkg.ljust(13), version_installed)
print(s)

What happens if you copy this into a python interpreter inside your shell?

>>> print(b"\xe2\x9c\x93".decode("utf-8"))

lagru avatar Jul 31 '19 23:07 lagru