question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install the package by pip due to some encoding error

See original GitHub issue

When I try to install the package via pip command, it generates the following error message:

Collecting pygetwindow (from pyautogui) Downloading https://files.pythonhosted.org/packages/f1/54/740939161eb3471e8f775ce9b0fcac0e54c36bf63501e51f2cd7158f587d/PyGetWindow-0.0.3.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File “<string>”, line 1, in <module> File “C:\Users******\AppData\Local\Temp\pip-install-wflouosi\pygetwindow\setup.py”, line 11, in <module> long_description = fh.read() UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa2 in position 905: illegal multibyte sequence

So I tried to modify the setup.py and change the line 11: Original: with open("README.md", "r") as fh: long_description = fh.read() New: with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read()

It looks like this change can bypass the issue,

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:10

github_iconTop GitHub Comments

3reactions
jtyouicommented, Jan 23, 2019

因为要安装pyautogui,结果要先安装依赖PyGetWindow,然后pip install PyGetWindow报错。 UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa2 in position 905: illegal multibyte sequence 我下载源码修改setup.py,将with open(“README.md”, “r”) 修改成 with open(“README.md”, “r”, encoding=“utf-8”)。 使用wheel进行安装即可。 安装命令: python setup.py bdist_wheel pip install dist/*

0reactions
alexlauszcommented, May 14, 2019

因为要安装pyautogui,结果要先安装依赖PyGetWindow,然后pip install PyGetWindow报错。 UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa2 in position 905: illegal multibyte sequence 我下载源码修改setup.py,将with open(“README.md”, “r”) 修改成 with open(“README.md”, “r”, encoding=“utf-8”)。 使用wheel进行安装即可。 安装命令: python setup.py bdist_wheel pip install dist/*

我在32位python下用此方法安装pygetwindow版本0.04不行,0.03版本可以

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip cannot install or upgrade, with UnicodeDecodeError ...
I am using anaconda Powershell Prompt in Win10. UnicodeDecodeError was reported when installing package with pip (version: 21.2.4).
Read more >
Changelog - pip documentation v22.3.1
A package in a wheel is (by definition) not installed, and is not guaranteed to work due to how a wheel is structured....
Read more >
codecs — Codec registry and base classes — Python 3.11.1 ...
This module defines base classes for standard Python codecs (encoders and ... Raises a LookupError in case the encoding cannot be found or...
Read more >
`pip install bpy` Not Working (LookupError: unknown encoding
You are missing the future-fstrings package. I'm not sure why it doesn't install automatically but a simple pip install future-fstrings ...
Read more >
Using Python's pip to Manage Your Projects' Dependencies
Note: On some Linux (Unix) systems like Ubuntu, pip comes in a separate package called python3-pip , which you need to install with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found