pipx icon indicating copy to clipboard operation
pipx copied to clipboard

Proposal: pipx clean/reset

Open sigma67 opened this issue 10 months ago • 2 comments

How would this feature be useful?

Pipx environment can become corrupted due to aborted installations (packages with missing metadata) or aborted shared upgrades.

Example error:

ModuleNotFoundError: No module named 'pip._internal.cli'

For this and other cases with corrupted metadata that are hard to recover from, it would be useful if pipx could reset itself to a first-installation state.

Describe the solution you'd like

Completely reset pipx to first installation state

Describe alternatives you've considered

Alternative is to manually delete pipx state. This is cumbersome however, as the location depends on the platform and each user needs to find out where it is located.

sigma67 avatar Feb 12 '25 07:02 sigma67

as the location depends on the platform and each user needs to find out where it is located.

If I may - my suggestion to you would be that for each platform, upon pipx installation, you and your team agree upon setting PIPX_HOME to the same directory. My example for Windows is %UserProfile%\pipx\. This way, you can know where the installation is easier and a script can be written to fix this.

powercoconola avatar Feb 28 '25 02:02 powercoconola

As with many things, one can work around this in many ways. But I think it's reasonable to have a way to remove the temporary state left on the system by a tool, with that tool.

Example from apt:

sudo apt-get clean

sigma67 avatar Feb 28 '25 06:02 sigma67