Skip to content

Should pip uninstall before updating dependencies? #9655

Open
@philthompson10

Description

@philthompson10

pip version

21.0.1

Python version

3.9.0

OS

Linux

Additional information

No response

Description

When upgrading a wheel, pip seems to do...

  • upgrades any dependencies (including installing new dependencies)
  • uninstalls the old version
  • installs the new version.

Expected behavior

I would expect it to do things in this order...

  • uninstalls the old version
  • upgrades any dependencies
  • installs the new version

How to Reproduce

No response

Output

No response

Code of Conduct

  • I agree to follow the PSF Code of Conduct

I have a package P v1.0. I then decided to split this into two separate packages, P v1.1 and D v1.0 where D is a dependency of P v1.1 and contains some of the files that were in P v1.0. I'll refer to those files as F.

If I have P v1.0 installed and then run pip install --upgrade P the following happens:

  • D v1.0 is installed which overwrites the F files from P v1.0
  • P v1.0 is uninstalled which removes the F files
  • P v1.1 is installed.

This leaves and installation without any F files. The fix is then to run pip install --force-reinstall D.

If pip uninstalled P v1.0 before updating the dependencies then this wouldn't happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: upgradeThe logic of upgrading packagestype: enhancementImprovements to functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions