Skip to content

Impossible to unistall invalid package (with wrong entry point name) #8461

@Conchylicultor

Description

@Conchylicultor

Environment

  • pip version: pip 20.1.1
  • Python version: 3.6
  • OS: MacOs

Description

I was experimenting with entry_points and released a test pip package with an invalid "entry-point" name: epot-test:

[tool.poetry.plugins."epot-test.test"]
"abc" = "epot_poetry_test.sub.other:SomeClass"

The pip install failed but pip is now in a bad state. Now it is impossible for me to uninstall the corrupted package.

Expected behavior
I would expect to be able to uninstall invalid packages.

How to Reproduce

pip install epot-poetry-test==0.2.0  # Install the corrupted package

# After the corrupted package is installed, it cannot be uninstalled or replaced:
pip uninstall epot-poetry-test  # Fail
pip epot-poetry-test --upgrade  # Fail

Output

epot-macbookpro% pip3 uninstall epot-poetry-test     
Found existing installation: epot-poetry-test 0.2.0
ERROR: Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2857, in get_entry_map
    ep_map = self._ep_map
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2815, in __getattr__
    raise AttributeError(attr)
AttributeError: _ep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/commands/uninstall.py", line 86, in run
    auto_confirm=options.yes, verbose=self.verbosity > 0,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 675, in uninstall
    uninstalled_pathset = UninstallPathSet.from_dist(dist)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 571, in from_dist
    console_scripts = dist.get_entry_map(group='console_scripts')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2860, in get_entry_map
    self._get_metadata('entry_points.txt'), self
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2535, in parse_map
    maps[group] = cls.parse_group(group, lines, dist)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2510, in parse_group
    raise ValueError("Invalid group name", group)
ValueError: ('Invalid group name', 'epot-test.test')

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions