pipx icon indicating copy to clipboard operation
pipx copied to clipboard

uninject --leave-deps can break dependencies for remaining packages

Open Vrihub opened this issue 3 months ago • 2 comments

Describe the bug

When uninjecting a package, pipx by default also uninstalls the dependencies of the uninjected package, unless the --leave-deps option is used.

This can break dependencies for remaining packages in the venv, which could have dependencies in common with the uninjected package.

I experienced this on a venv in which a package with some "extras" was installed, as in pipx install package[extra1,extra2]. When uninjecting the packages needed for extra2, some dependencies in common with extra1 were uninstalled too, breaking its functionality.

Expected behavior

First best would be to have uninject to check if any dependency planned to be uninstalled is also a dependency for other packages in the venv, and don't uninstall it if that's the case.

If that is not possible, I think that --leave-deps should be the default behaviour with uninject, and there should be a --uninstall-deps (or --include-deps?) option to force the current default behaviour (after warning the user about potentially dangerous effects).

Vrihub avatar Sep 17 '25 11:09 Vrihub

Hi!
I'm an engineering student currently contributing to open-source projects as part of my Erasmus semester.
I'd like to work on this issue (#1672) and propose a fix that checks whether dependencies are still required by other injected packages before uninstalling them.

I've already reviewed the codebase and read the CONTRIBUTING guide, so I can start working on it right away.
Could you please assign this issue to me or confirm that it's still available?

Thanks in advance!

CorentinDurand avatar Nov 19 '25 13:11 CorentinDurand

It is available, feel free to work on it! :D

dukecat0 avatar Nov 19 '25 14:11 dukecat0