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

error on pip install, tried with various packages #10984

Closed
1 task done
CodingVoid opened this issue Mar 24, 2022 · 7 comments
Closed
1 task done

error on pip install, tried with various packages #10984

CodingVoid opened this issue Mar 24, 2022 · 7 comments
Labels
project: <downstream> When the cause/effect is related to redistributors

Comments

@CodingVoid
Copy link

Description

If I try to install a package via pip, I get an error. Weirdly not all packages are affected.
I have a rather frech Arch Linux Installation.
I installed pip and got the error with the first package I tried to install via pip (so my ~/.local/lib/python3.10/site-packages folder contains only a few files)

Expected behavior

install package without error

pip version

21.0

Python version

3.10

OS

Arch Linux

How to Reproduce

  1. Install python-pip via pacman
  2. Install a package e.g: pip install --user wheel (doesn't matter if --user is specified or not)

Output

Defaulting to user installation because normal site-packages is not writeable
Collecting wheel
  Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3030, in _dep_map
    return self.__dep_map
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2827, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
    status = self.run(options, args)
  File "/usr/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 178, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 316, in run
    requirement_set = resolver.resolve(
  File "/usr/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 121, in resolve
    self._result = resolver.resolve(
  File "/usr/lib/python3.10/site-packages/resolvelib/resolvers.py", line 454, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/usr/lib/python3.10/site-packages/resolvelib/resolvers.py", line 348, in resolve
    failure_causes = self._attempt_to_pin_criterion(name, criterion)
  File "/usr/lib/python3.10/site-packages/resolvelib/resolvers.py", line 208, in _attempt_to_pin_criterion
    criteria = self._get_criteria_to_update(candidate)
  File "/usr/lib/python3.10/site-packages/resolvelib/resolvers.py", line 199, in _get_criteria_to_update
    for r in self._p.get_dependencies(candidate=candidate):
  File "/usr/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 170, in get_dependencies
    return [
  File "/usr/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 170, in <listcomp>
    return [
  File "/usr/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 251, in iter_dependencies
    requires = self.dist.requires() if with_requires else ()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2748, in requires
    dm = self._dep_map
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3032, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3042, in _compute_dependencies
    reqs.extend(parse_requirements(req))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3098, in parse_requirements
    yield Requirement(line)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3108, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 113, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 1100, in parse_string
    loc, tokens = self._parse(instring, 0)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 790, in _parseNoCache
    loc, tokens = self.parseImpl(instring, pre_loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 3810, in parseImpl
    loc, exprtokens = e._parse(instring, loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 790, in _parseNoCache
    loc, tokens = self.parseImpl(instring, pre_loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 4024, in parseImpl
    return e._parse(
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 790, in _parseNoCache
    loc, tokens = self.parseImpl(instring, pre_loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 3810, in parseImpl
    loc, exprtokens = e._parse(instring, loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 790, in _parseNoCache
    loc, tokens = self.parseImpl(instring, pre_loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 4854, in parseImpl
    loc, tokens = self_expr._parse(instring, loc, doActions, callPreParse=False)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 790, in _parseNoCache
    loc, tokens = self.parseImpl(instring, pre_loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 3810, in parseImpl
    loc, exprtokens = e._parse(instring, loc, doActions)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 827, in _parseNoCache
    tokens = fn(instring, tokens_start, ret_tokens)
  File "/usr/lib/python3.10/site-packages/pyparsing/core.py", line 283, in wrapper
    ret = func(*args[limit:])
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 81, in <lambda>
    lambda s, l, t: Marker(s[t._original_start : t._original_end])
TypeError: slice indices must be integers or None or have an __index__ method

Code of Conduct

@CodingVoid CodingVoid added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Mar 24, 2022
@SnoopJ
Copy link
Contributor

SnoopJ commented Mar 25, 2022

Found this issue because of another Arch user reporting the same problem in #python on the Libera IRC network. They also got this error when running python3 -m pip show packaging.

It looks like Arch updated their python3 package recently. I don't see any bug reports in their tracking, but I suspect this has broken something on their end.

@CodingVoid have you tried rolling back the python3 package a version or two?

@uranusjr
Copy link
Member

This looks very much like an Arch issue. Nothing we can do here without Arch input.

@uranusjr uranusjr added project: <downstream> When the cause/effect is related to redistributors and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Mar 25, 2022
@SnoopJ
Copy link
Contributor

SnoopJ commented Mar 25, 2022

FWIW, I did try reproducing this in an Arch container, and was NOT able to get the same error, it seemed to work fine, even with the recently-updated python3 package.

In the case of the user inquiry that brought me here, there is some custom package machinery that I suspect may have been causing the issue. Not sure, though.

@uranusjr
Copy link
Member

Could you try if you can reproduce this with a non-Arch installed pip? You can try without populating the environment by downloading the pip wheel from PyPI.org, and run it like this:

$ python3 ./pip-22.0.4-py3-none-any.whl/pip

@SnoopJ
Copy link
Contributor

SnoopJ commented Mar 25, 2022

Could you try if you can reproduce this with a non-Arch installed pip?

Had a go, but no luck, can't reproduce

@uranusjr
Copy link
Member

Then it’s likely a combination of Arch’s pip and something in your environment. Maybe try copying things in your /usr/lib/python3.10/site-packages incrementally into a container and see if you can find what’s causing the issue.

@CodingVoid
Copy link
Author

CodingVoid commented Mar 25, 2022

Now it works
I only have python version 3.10.3 and pip version 3.10.3 installed. No other arch linux python package. So the problem had to reside in either python, pip or one of the dependencies of these two packages.
I upgraded my system and got 3 package upgrades:
atk-2.38.0-1
iproute2-5.17.0-1
python-pyparsing-3.0.7-1
Seems like the python-pyparsing package was the problem, because now I can install all packages successfully again.

Thanks for your help and fast replies.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
project: <downstream> When the cause/effect is related to redistributors
Projects
None yet
Development

No branches or pull requests

3 participants