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.

error on pip install, tried with various packages

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
CodingVoidcommented, 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.

0reactions
uranusjrcommented, Mar 25, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`pip install` Gives Error on Some Packages - Stack Overflow
Some packages give errors when I try to install them using pip install . This is the error when I try to install...
Read more >
How to install modules with PIP (and fix it when it fails) - Medium
Try typing: pip3 install (THE NAME OF THE MODULE). This may work if you have multiple versions of python installed, one of them...
Read more >
pip Command Not Found – Mac and Linux Error Solved
Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the...
Read more >
How to Install Pip on Windows - ActiveState
Adding PIP to Windows Environment Variables ... One of the most common problems with running Python tools like pip is the “not on...
Read more >
How to Fix Python `No such file or directory` Compiler Errors ...
This can be misleading, because you usually aren't missing a file or directory from the package you're trying to install. Instead, this error ......
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