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 with pip installing anything #5016

Closed
JWDobken opened this issue Feb 4, 2018 · 5 comments
Closed

UnicodeDecodeError with pip installing anything #5016

JWDobken opened this issue Feb 4, 2018 · 5 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@JWDobken
Copy link

JWDobken commented Feb 4, 2018

  • Pip version: 9.0.1
  • Python version: 3.6 (miniconda)
  • Operating system: Ubuntu 16.04.3 LTS

Description:

I am trying to install any package with pip, but this gives me a UnicodeDecodeError. Strangely this does work in the main user directory, but not in a python package directory.

What I've run:

For example update pip itself:

pip install -U pip

Returns:

Requirement already up-to-date: pip in /home/USER/miniconda3/envs/PYENV/lib/python3.6/site-packages
Exception:
Traceback (most recent call last):
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/site-packages/pip/commands/install.py", line 350, in run
    isolated=options.isolated_mode,
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/site-packages/pip/commands/install.py", line 436, in get_lib_location_guesses
    scheme = distutils_scheme('', *args, **kwargs)
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/site-packages/pip/locations.py", line 141, in distutils_scheme
    d.parse_config_files()
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/distutils/dist.py", line 395, in parse_config_files
    parser.read(filename)
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/configparser.py", line 1015, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/home/USER/miniconda3/envs/PYENV/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 104: ordinal not in range(128)

Notes

  • the directory name does not contain non-ascii characters as suggested here. It contains lowercase letters and dashes ("-").
  • which pip from the main and sub directory return the same pip (/home/USER/miniconda3/envs/PYENV/bin/pip)
  • if I make a non-python-package directory who's name only contains lowercase letters and dashes ("-") there is no error (like "test-this-name").
@JWDobken
Copy link
Author

JWDobken commented Feb 5, 2018

So I found the cause of the issue.

I was not aware that pip would read the file setup.py, but apparently it does.
This file contains my surname with an umlaut (ö), so replacing it solved to issue... for now.

This umlaut has been there forever and until last week never caused this error.

@pradyunsg
Copy link
Member

Hi! Thanks for filing this issue!

Could you take a look and determine if this is still an issue with the latest master?

@pradyunsg
Copy link
Member

Closing due to a lack of a response.

@noopurphalak
Copy link

noopurphalak commented Nov 22, 2018

@pradyunsg Yes, there is.
I tried running pre-commit with pyenv enabled and I am getting the same error.

Environment:
pip 18.1
pyenv 1.2.7
pre-commit 1.11.2

Below is the stack trace:

`
An unexpected error has occurred: CalledProcessError: Command: ('/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/bin/python3.6', '/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/bin/pip', 'install', '.')
Return code: 2
Expected return code: 0
Output:
Processing /Users/noopurp123/.cache/pre-commit/repouuucjfi5

Errors:
Exception:
Traceback (most recent call last):
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 291, in run
resolver.resolve(requirement_set)
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolve.py", line 103, in resolve
self._resolve_one(requirement_set, req)
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
self.require_hashes
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 324, in prepare_linked_requirement
abstract_dist.prep_for_dist(finder, self.build_isolation)
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 126, in prep_for_dist
build_requirements, isolate = self.req.get_pep_518_info()
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 448, in get_pep_518_info
pp_toml = pytoml.load(f)
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/pytoml/parser.py", line 10, in load
return loads(fin.read(), translate=translate, filename=getattr(fin, 'name', repr(fin)))
File "/Users/noopurp123/.cache/pre-commit/repouuucjfi5/py_env-python3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 826: ordinal not in range(128)
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
`

@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
@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2019
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
Projects
None yet
Development

No branches or pull requests

3 participants