pypa/pip

package upgrade breaks installation

Closed this issue · 1 comments

Description

I am the maintainer of python-Levenshtein. For historic reasons the package is named python-Levenshtein on pypi, but actually installed as Levenshtein. There is a fork of the project called Levenshtein which is API compatible and installs as Levenshtein as expected. To resolve this situation I converted the python-Levenshtein package to an empty setuptools package, with the Levenshtein package as dependency. However upgrading the package using pip leads to a broken installation.

Expected behavior

I expected:

python3.10 -m pip install python-Levenshtein==0.12.2
python3.10 -m pip install -U python-Levenshtein

to lead to the same end result as

python3.10 -m pip install python-Levenshtein

pip version

22.3

Python version

python3.10

OS

Fedora

How to Reproduce

install version 0.12.2 of python-Levenshtein:

python3.10 -m pip install python-Levenshtein==0.12.2

upgrade the package to the latest version

python3.10 -m pip install -U python-Levenshtein

this leads to a broken installation of Levenshtein

Output

$ python3.10 -m pip install python-Levenshtein==0.12.2
Defaulting to user installation because normal site-packages is not writeable
Collecting python-Levenshtein==0.12.2
  Using cached python_Levenshtein-0.12.2-cp310-cp310-linux_x86_64.whl
Requirement already satisfied: setuptools in /home/max/.local/lib/python3.10/site-packages (from python-Levenshtein==0.12.2) (65.3.0)
Installing collected packages: python-Levenshtein
Successfully installed python-Levenshtein-0.12.2

$ python3.10 -m pip install -U python-Levenshtein
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: python-Levenshtein in /home/max/.local/lib/python3.10/site-packages (0.12.2)
Collecting python-Levenshtein
  Using cached python_Levenshtein-0.20.8-py3-none-any.whl (9.4 kB)
Collecting Levenshtein==0.20.8
  Using cached Levenshtein-0.20.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (174 kB)
Requirement already satisfied: rapidfuzz<3.0.0,>=2.3.0 in /home/max/.local/lib/python3.10/site-packages (from Levenshtein==0.20.8->python-Levenshtein) (2.12.0)
Installing collected packages: Levenshtein, python-Levenshtein
  Attempting uninstall: python-Levenshtein
    Found existing installation: python-Levenshtein 0.12.2
    Uninstalling python-Levenshtein-0.12.2:
      Successfully uninstalled python-Levenshtein-0.12.2
Successfully installed Levenshtein-0.20.8 python-Levenshtein-0.20.8

$ ls /home/max/.local/lib/python3.10/site-packages/Levenshtein/
__init__.pyi  levenshtein_cpp.cpython-310-x86_64-linux-gnu.so  py.typed

$ python3.10 -m pip uninstall Levenshtein python-Levenshtein
Found existing installation: Levenshtein 0.20.8
Uninstalling Levenshtein-0.20.8:
  Would remove:
    /home/max/.local/lib/python3.10/site-packages/Levenshtein-0.20.8.dist-info/*
    /home/max/.local/lib/python3.10/site-packages/Levenshtein/__init__.pyi
    /home/max/.local/lib/python3.10/site-packages/Levenshtein/levenshtein_cpp.cpython-310-x86_64-linux-gnu.so
    /home/max/.local/lib/python3.10/site-packages/Levenshtein/py.typed
Proceed (Y/n)? Y
  Successfully uninstalled Levenshtein-0.20.8
Found existing installation: python-Levenshtein 0.20.8
Uninstalling python-Levenshtein-0.20.8:
  Would remove:
    /home/max/.local/lib/python3.10/site-packages/python_Levenshtein-0.20.8.dist-info/*
Proceed (Y/n)? Y
  Successfully uninstalled python-Levenshtein-0.20.8

$ python3.10 -m pip install python-Levenshtein
Defaulting to user installation because normal site-packages is not writeable
Collecting python-Levenshtein
  Using cached python_Levenshtein-0.20.8-py3-none-any.whl (9.4 kB)
Collecting Levenshtein==0.20.8
  Using cached Levenshtein-0.20.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (174 kB)
Requirement already satisfied: rapidfuzz<3.0.0,>=2.3.0 in /home/max/.local/lib/python3.10/site-packages (from Levenshtein==0.20.8->python-Levenshtein) (2.12.0)
Installing collected packages: Levenshtein, python-Levenshtein
Successfully installed Levenshtein-0.20.8 python-Levenshtein-0.20.8

$ ls /home/max/.local/lib/python3.10/site-packages/Levenshtein/
__init__.py  __init__.pyi  levenshtein_cpp.cpython-310-x86_64-linux-gnu.so  __pycache__  py.typed  StringMatcher.py

Code of Conduct

Essentially dplicate of #8509