Pip: Name canonicalization issue in pip uninstall

Created on 21 Jul 2020  路  5Comments  路  Source: pypa/pip

Environment

  • pip version: 20.1
  • Python version: 3
  • OS: Linux (probably irrelevant)

Description

pip uninstall should canonicalize names when determining if they are installed.

How to Reproduce

$ pip install zope-interface  # notice the dash
$ pip list
...
zope.interface  # notice the dot
$ pip uninstall zope-interface  # same name as in pip install
WARNING: Skipping zope-interface as it is not installed.

Expected result

In the example above, pip should have uninstalled zope.interface.

This is easily worked around when used manually, but is more annoying when the uninstall command is invoked by tools working with canonical names.

uninstall bug

All 5 comments

Looks like it's fixed in #8054.

@atugushev, I can still reproduce this using master pip—GH-8054 only seems to fix it for pip install and pip list {-u,-o} but pip list and pip uninstall.

@McSinyx

Checked on aff33ffc4c8c8bad46aa980ebc20f3de1072da5b:

$ pip --version
pip 20.2.dev1 from /Users/albert/Projects/pip/src/pip (python 3.8)

$ pip install zope-interface
Collecting zope-interface
  Using cached zope.interface-5.1.0-cp38-cp38-macosx_10_9_x86_64.whl (192 kB)
Requirement already satisfied: setuptools in ./.venv/lib/python3.8/site-packages (from zope-interface) (45.2.0)
Installing collected packages: zope-interface
Successfully installed zope-interface

$ pip list | grep zope
zope.interface       5.1.0

$ pip uninstall zope-interface
Found existing installation: zope.interface 5.1.0
Uninstalling zope.interface-5.1.0:
  Would remove:
    /Users/albert/Projects/pip/.venv/lib/python3.8/site-packages/zope.interface-5.1.0-py3.8-nspkg.pth
    /Users/albert/Projects/pip/.venv/lib/python3.8/site-packages/zope.interface-5.1.0.dist-info/*
    /Users/albert/Projects/pip/.venv/lib/python3.8/site-packages/zope/interface/*
Proceed (y/n)?

Please have my apologies: you are correct, I was testing on an venv and it uses pip's latest release instead of the editable version. I can confirm that the problem is solved as of current master.

Ah, perfect. Thanks for investigating this @atugushev.

Was this page helpful?
0 / 5 - 0 ratings