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" when pip install #231

Closed
curiositer opened this issue Apr 14, 2019 · 7 comments
Closed

"UnicodeDecodeError" when pip install #231

curiositer opened this issue Apr 14, 2019 · 7 comments

Comments

@curiositer
Copy link

Describe the bug
when I try to use pip install Flask-MonitoringDashboard,it happened.
File "C:...\flask-monitoringdashboard\setup.py", line 11, in get_description
info = readme.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 1571: illegal multibyte sequence

Command "python setup.py egg_info" failed with error code 1 in C:...\pip-install-c4devic4\Flask-MonitoringDashboard\

To Reproduce
Steps to reproduce the behavior:
1.pip install Flask-MonitoringDashboard
2. See error

or
1.Download the source
2. Add ".encode("utf-8")" after "readme.read()"
3.See error

Expected behavior
I want to install this.

Screenshots
123456

Desktop (please complete the following information):

  • OS: [windows 10 professional]

Additional context
so I know it is an UnicodeDecodeError,but I cannot deal with it,thanks so much!

@bogdanp05
Copy link
Member

Hi @curiositer,

I wasn't able to replicate this. I used the following settings on my system:

  • Windows 10 64 bit
  • virtual environment as described here
  • Python 3.7.3

Running pip install Flask-MonitoringDashboard installed the package successfully. Could you give us more details about your system, so we can try to replicate the error?

Regards,
Bogdan

@curiositer
Copy link
Author

Oh,thanks! I have solved the problem.

I used pip install flask-Monitoring-Dashboard, and it succeed.
Without of using "-",when I used pip install Flask-MonitoringDashboard,the error happened.

Thanks a lot, but I don'n know why,maybe it doesn't match with the "gbk" unicode?

I used the following settings on my system:

  • Windows 10 64 bit
  • Python 3.6.8 :: Anaconda, Inc.

Haha, my English is not so well,thank you for your reply.

Regards,
John

@bogdanp05
Copy link
Member

I used pip install flask-Monitoring-Dashboard, and it succeed.

I'm afraid you installed something else. You installed this, which is a very old and no longer supported version of the Flask Monitoring Dashboard package, whereas the new version is this one.

Could you try to run pip install Flask-MonitoringDashboard inside a virtual environment? Also, what does sys.getdefaultencoding() return on your system?

Thanks a lot, but I don'n know why,maybe it doesn't match with the "gbk" unicode?

It's probably trying to use GBK to read a file encoded with UTF-8

@curiositer
Copy link
Author

curiositer commented Apr 15, 2019

Oh,thanks for warning me,I must install the old version.

When I run this:
import sys sys.getdefaultencoding()
The result is: "'utf-8'"

And I run "pip install Flask-MonitoringDashboard",I got the same error as I had met.(The screenshot I had posted upstairs.)
Then I tried the url you have given to me,download it, unzip, and python setup.py install,but got the same error.
So how to deal with it?Thanks!

@bogdanp05
Copy link
Member

In the setup.py file, try to replace line 10:
with open(loc + '/README.md') as readme:
with this:
with open(loc + '/README.md', encoding='utf-8') as readme:
Let me know if this fixes the error.

@curiositer
Copy link
Author

Thanks so much,I installed it successfully,I had tried change the read() encode,but it doesn't exist.
I forget the open function can change the encoding.
It seems to have another error,I think maybe because of the Internet,and then I tried to use pip install Flask-MonitoringDashboard, finally it succeed.
The error code below:

error: Download error for https://files.pythonhosted.org/packages/ed/29/d97b6252591da5f8add0d25eecda296ea72729a0aad7998edba1981b47c8/numpy-1.16.2-cp36-cp36m-win_amd64.whl#sha256=d20c0360940f30003a23c0adae2fe50a0a04f3e48dc05c298493b51fd6280197: EOF occurred in violation of protocol (_ssl.c:852)

I have installed the package successfully.Thanks a lot!

@bogdanp05
Copy link
Member

Glad I could help!

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