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 for obonet0.2.5 #25

Closed
ItWasLGS opened this issue Mar 8, 2022 · 3 comments
Closed

UnicodeDecodeError for obonet0.2.5 #25

ItWasLGS opened this issue Mar 8, 2022 · 3 comments

Comments

@ItWasLGS
Copy link

ItWasLGS commented Mar 8, 2022

Hi,I am a new one to obonet and recently have an strict environment restriction for obonet0.2.5 and python3.7.9
As I try to install it I meet an UnicodeDecodeError such as shown belows:

(test2) C:\Users\dell>pip install obonet==0.2.5
Collecting obonet==0.2.5
  Using cached obonet-0.2.5.tar.gz (5.5 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\dell\AppData\Local\Temp\pip-install-fdy53bp6\obonet_fcba39b79d6c476f949856c09ef9088c\setup.py", line 18, in <module>
          long_description = read_file.read()
      UnicodeDecodeError: 'gbk' codec can't decode byte 0xa5 in position 935: illegal multibyte sequence
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

the environment test2 shown above is a brand new environment with python3.7.9 construted by anaconda,I've read the closed issues but it didn't make it with any pip updates,please help me with this embarrasing bug(O-r-z),thank you!

@dhimmel
Copy link
Owner

dhimmel commented Mar 8, 2022

Here is the source code where your error is occurring in v0.2.5:

obonet/setup.py

Lines 17 to 18 in 07365ec

with readme_path.open() as read_file:
long_description = read_file.read()

Notice how our setup.py didn't specify an encoding. It should have specified encoding = 'utf-8', such that when a user system defaults to a different encoding, it would still use utf-8. You can try to run the following:

PYTHONIOENCODING=UTF-8 pip install obonet==0.2.5

That might work. Otherwise, can you upgrade to latest obonet version 0.3.0, which shouldn't have this problem.

@ItWasLGS
Copy link
Author

ItWasLGS commented Mar 9, 2022

Thanks for your quick reply,I think I might get where the error is from,but after I run your code listed above something else goes wrong,as shown below:

(test2) C:\Users\dell>PYTHONIOENCODING=UTF-8 pip install obonet==0.2.5
'PYTHONIOENCODING' is not recognized as an internal or external command,
operable program or batch file.

It frustrated me and I come back to look for your help..
But in the other way,considering it's an encoding error,I downloaded your obonet ver0.2.5,changed line 17 in setup.py into:

with readme_path.open(encoding='utf-8') as read_file

then I successfully in pip install progress,but I wonder would this change have an bad effect on obonet(or even ruin your code) since it's too simple while nobody has tried it?

@dhimmel
Copy link
Owner

dhimmel commented Mar 9, 2022

but after I run your code listed above something else goes wrong,as shown below

The code should work in a bash (or other unix-like) shell, but does not work on the Windows command prompt.

I wonder would this change have an bad effect on obonet(or even ruin your code) since it's too simple while nobody has tried it?

That is fine. Personally I think upgrading to the latest obonet==0.3.0 is a better solution, since it doesn't require manually editing a file everytime.

Glad you were able to find a method that works.

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

2 participants