wilson-eft / wilson

A Python package for the running and matching of Wilson coefficients above and below the electroweak scale
https://wilson-eft.github.io
MIT License
26 stars 19 forks source link

Installation fails on Chinese version of Windows #47

Closed peterstangl closed 4 years ago

peterstangl commented 4 years ago

On a Chinese version of Windows, installation fails with the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\h8621\AppData\Local\Temp\pip-install-pddygxyk\wilson\setup.py", line 7, in <module>
    LONG_DESCRIPTION = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 272: illegal multibyte sequence

It looks like the problem is caused by setup.py reading the file README.md, which is utf-8 encoded. In particular, the en dash at position 272 of that file is a multibyte character that is not properly decoded. I assume that this problem can be fixed by explicitly specifying the file encoding when opening the file, i.e. by changing line 6 of setup.py to

with open("README.md", encoding="utf-8") as f:

I asked the person reporting that problem to test if my proposed solution solves the problem.

DavidMStraub commented 4 years ago

Wow, this comes as a shock to me, Python does not use UTF-8 by default for open :open_mouth:

peterstangl commented 4 years ago

It probably uses the default encoding of the operating system, which on (at least some) Chinese versions of Windows seems to be GBK instead of UTF-8 (https://en.wikipedia.org/wiki/GBK_(character_encoding))

peterstangl commented 4 years ago

see also https://discuss.python.org/t/pep-597-use-utf-8-for-default-text-file-encoding

peterstangl commented 4 years ago

The person who has reported the problem has downloaded the wilson source, modified setup.py as suggested, and was able to install the package. I have implemented this modification in PR #48.

DavidMStraub commented 4 years ago

Fixed by #48.