r9y9 / nnmnkwii

Library to build speech synthesis systems designed for easy and fast prototyping.
https://r9y9.github.io/nnmnkwii/latest/
Other
393 stars 74 forks source link

pip install produces UnicodeCodecError #42

Closed rafaelvalle closed 7 years ago

rafaelvalle commented 7 years ago

Hi! I get a UnicodeDecodeError when trying to install your library.

pip install --user nnmnkwii
Collecting nnmnkwii
  Using cached nnmnkwii-0.0.6.tar.gz
    Complete output from command python setup.py egg_info:
    fatal: Not a git repository (or any parent up to mount point /tmp)
    Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-1it86_s_/nnmnkwii/setup.py", line 110, in <module>
        README = open('README.rst').read()
      File "/opt/conda/envs/pytorch-py35/lib/python3.5/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 300: ordinal not in range(128)

Any thoughts what this could be and how to fix it?

r9y9 commented 7 years ago

Thank you for reporting this. I cannot reproduce this locally with fresh conda env, but it looks like apparently an encoding issue. Could you try to clone the repository and apply the following patch and see how it works?

diff --git a/setup.py b/setup.py
index a3f83fe..c5fbc9e 100644
--- a/setup.py
+++ b/setup.py
@@ -107,7 +107,7 @@ if not exists('README.rst'):
     create_readme_rst()

 if exists('README.rst'):
-    README = open('README.rst').read()
+    README = open('README.rst', 'rb').read().decode("utf-8")
 else:
     README = ''
rafaelvalle commented 7 years ago

Yes, indeed the problem is with the ASCII UTF-8 encoding. Another possible solution is to open the file with the UTF-8 encoding.

README = open('README.rst', 'rb', encoding='utf-8').read()

Note that the tacotron_pytorch repo will produce a similar error in train.py for classes TextDataSource and _NPYDataSource

r9y9 commented 7 years ago

The library supports python2.7, so that solution isn't enough actually. I will try to address same issues in tactoron_pytorch soon.

r9y9 commented 7 years ago

https://github.com/r9y9/tacotron_pytorch/commit/bdad19fdff22016c7457a979707655bb7a605cd8

Could you confirm if it fixes your issue?