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

When try to install shapely on Python3(32bit) on Windows 7, UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte #4903

Closed
chenzx opened this issue Dec 4, 2017 · 16 comments
Labels
auto-locked Outdated issues that have been locked by automation C: encoding Related to text encoding and likely, UnicodeErrors resolution: duplicate Duplicate of an existing issue/PR

Comments

@chenzx
Copy link

chenzx commented Dec 4, 2017

  • Pip version: pip 9.0.1 from C:\Python36-32\lib\site-packages (python 3.6)
  • Python version: Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
  • Operating system: Windows 7

Description:

// REPLACE ME: What are you trying to get done, what has happened, what went wrong, and what did you expect?

What I've run:

python -m pip install shapely
Collecting shapely
  Using cached Shapely-1.6.2.post1.tar.gz
Exception:
Traceback (most recent call last):
  File "C:\Python36-32\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Python36-32\lib\site-packages\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "C:\Python36-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Python36-32\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "C:\Python36-32\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "C:\Python36-32\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "C:\Python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "C:\Python36-32\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte
@ghost
Copy link

ghost commented Dec 4, 2017

Fixed in 8a10132.

@pradyunsg
Copy link
Member

Hi @chenzx!

As @xoviat says, this has been fixed in #4486. It'll be released in the next major version release of pip. Until then, you can try using a workaround from #4110.

@pradyunsg pradyunsg added C: encoding Related to text encoding and likely, UnicodeErrors type: bug A confirmed bug or unintended behavior resolution: duplicate Duplicate of an existing issue/PR and removed type: bug A confirmed bug or unintended behavior labels Dec 4, 2017
@pradyunsg
Copy link
Member

@chenzx Could you try out pip 10 beta and confirm if this is fixed?

@pradyunsg pradyunsg added the S: awaiting response Waiting for a response/more information label Apr 8, 2018
@chenzx
Copy link
Author

chenzx commented Apr 10, 2018

C:\Python36-32>python -m pip install shapely
Requirement already satisfied: shapely in c:\python36-32\lib\site-packages
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Python36-32>python -m pip install --upgrade pip
Collecting pip
  Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 22kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3

C:\Python36-32>python -m pip install shapely
Requirement already satisfied: shapely in c:\python36-32\lib\site-packages

C:\Python36-32>python -m pip install --upgrade shapely
Collecting shapely
  Downloading Shapely-1.6.4.post1.tar.gz (224kB)
    100% |████████████████████████████████| 225kB 30kB/s
Exception:
Traceback (most recent call last):
  File "C:\Python36-32\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Python36-32\lib\site-packages\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "C:\Python36-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Python36-32\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "C:\Python36-32\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "C:\Python36-32\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "C:\Python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "C:\Python36-32\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte

not fixed.

PS: this problem was solved by use Python-2.7 months ago, so now i'm not bothered anymore.

@chenzx
Copy link
Author

chenzx commented Apr 10, 2018

I'll wait for pip 10 beta to stable and then have a try. :-)

@chenzx
Copy link
Author

chenzx commented Apr 10, 2018 via email

@pradyunsg
Copy link
Member

pip install -U --pre pip

@pradyunsg
Copy link
Member

Wait, Windows.

python -m pip install -U --pre pip

Or py -2 (however you run Python)

@chenzx
Copy link
Author

chenzx commented Apr 10, 2018 via email

@chenzx
Copy link
Author

chenzx commented Apr 11, 2018

C:\Python36-32>python -m pip install -U --pre pip
Collecting pip
  Downloading pip-10.0.0b2-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 26kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-10.0.0b2

C:\Python36-32>python -m pip install --upgrade shapely
Collecting shapely
  Using cached Shapely-1.6.4.post1.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\BANMA-~2\AppData\Local\Temp\pip-install-bd05s5bp\shapely\setup.py", line 80, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "C:\Users\BANMA-~2\AppData\Local\Temp\pip-install-bd05s5bp\shapely\shapely\_buildcfg.py", line 200, in <module>
        lgeos = CDLL("geos_c.dll")
      File "C:\Python36-32\lib\ctypes\__init__.py", line 348, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: [WinError 126] 找不到指定的模块。

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\BANMA-~2\AppData\Local\Temp\pip-install-bd05s5bp\shapely\

@pradyunsg
Copy link
Member

That looks like an issue with Shapely.

@pfmoore
Copy link
Member

pfmoore commented Apr 11, 2018

@pradyunsg is correct - the Shapely setup.py is loading DLLs as part of its configuration, and that's what is failing. You need to report this issue to the Shapely project.

In pip 9.0.1 the fact that this was an error in the Shapely configuration was hidden by the fact that we didn't correctly display the OS error (because it contained non-ASCII characters). But pip 10 shows the error clearly - unfortunately I don't read the language, so I can't confirm exactly what Windows is saying has gone wrong.

@chenzx
Copy link
Author

chenzx commented Apr 11, 2018

ok, so the old pip decode error is just because of a chinese error info string? if that's the point, i guess it's Shapely's problem.

@pfmoore
Copy link
Member

pfmoore commented Apr 11, 2018

Correct.

@pradyunsg pradyunsg added the S: needs triage Issues/PRs that need to be triaged label May 11, 2018
@xavfernandez
Copy link
Member

Since this appears to be a shapely issue, I'm closing this.

@lock
Copy link

lock bot commented May 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 31, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label May 31, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2019
@pradyunsg pradyunsg removed the S: awaiting response Waiting for a response/more information label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: encoding Related to text encoding and likely, UnicodeErrors resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

4 participants