XanaduAI / thewalrus

A library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling.
https://the-walrus.readthedocs.io
Apache License 2.0
100 stars 55 forks source link

Installation - UnicodeDecodeError #2

Closed AlaricCheng closed 6 years ago

AlaricCheng commented 6 years ago

Hi, I'm trying to install hafnian in my ubuntu, but it displays an error

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3125: ordinal not in range(128)

The full information is

root@e8c01b001d47:/# python3.6 -m pip install hafnian
Collecting hafnian
  Using cached https://files.pythonhosted.org/packages/fe/0f/dd394adfc0f93cc239d0c0f3eb63c116fa92d14031ad3b05e8d4cffcba6b/Hafnian-0.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-yfs7j_wf/hafnian/setup.py", line 73, in <module>
        'long_description': open('README.rst').read(),
      File "/usr/local/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3125: ordinal not in range(128)

Could you fix it? Thank you!

josh146 commented 6 years ago

Hi Alaric,

It looks like the issue might be the default encoding on your system, see this relevant bug report: https://github.com/facebookresearch/DrQA/issues/31

By default, Python 3.6 should be using unicode encoding, but it looks like your system is using ASCII. What is the output of the following command?

>>> import sys
>>> sys.getdefaultencoding()
AlaricCheng commented 6 years ago

Thanks for reply. The output is utf-8.

root@e8c01b001d47:/# python3.6
Python 3.6.0 (default, Dec 17 2017, 09:17:58)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaultencoding()
'utf-8'

Actually, I was using the ubuntu docker image, which might be relavant to this problem. Then I changed to use ubuntu on a virtual machine, and it worked. So personally, this problem has been solved, and you can feel free to close this issue. Though others might need a solution.

Thanks again!