Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command - pip reset #12694

Open
1 task done
fakabbir opened this issue May 11, 2024 · 6 comments
Open
1 task done

Command - pip reset #12694

fakabbir opened this issue May 11, 2024 · 6 comments
Labels
type: feature request Request for a new feature

Comments

@fakabbir
Copy link

What's the problem this feature will solve?

Problem:
Once packages are installed, there is not way to come to the starting point in base environement except creating a new virtual env

Solution:
pip reset command would uninstall all the libraries which are not installed as a base package.

Describe the solution you'd like

A pip reset commnand

Alternative Solutions

pip uninstall command can be more powerfull

Additional context

Requires creating venv in case the base python has a lots of packages and is not maintained well

Code of Conduct

@fakabbir fakabbir added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels May 11, 2024
@pfmoore
Copy link
Member

pfmoore commented May 11, 2024

Deleting and recreating a virtual environment is, by design, a fast operation. The proposed pip subcommand would merely be a slower way of doing the same thing. Thanks for the suggestion but I don’t think it’s something we would want to spend our limited bandwidth on.

@pradyunsg
Copy link
Member

https://github.com/pradyunsg/dotfiles/blob/main/src/python/.zsh/8-v.symlink.zsh#L111

This is something that could be done externally to pip today, like I have in the link above.

@pfmoore while I agree with your assessment here, I will say that this issue represents a desire for a lower-effort way of doing things. Specifically, that recreating a virtual environment requires knowing/typing the path or some substitute and it's often nice to not have to think about details like that.

@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label May 12, 2024
@fakabbir
Copy link
Author

Its more of a way to revert the base environment, which is generally used by default

@pfmoore
Copy link
Member

pfmoore commented May 12, 2024

When you say the “base environment”, do you mean the system Python, i.e. not a virtual environment? If so, then generally the advice is not to install packages direct into the base environment - in many cases, you should be managing that environment using a system package manager rather than pip anyway.

But if you do need to do that, a script such as the one @pradyunsg linked to, is probably the best way.

@fakabbir
Copy link
Author

When you say the “base environment”, do you mean the system Python, i.e. not a virtual environment? If so, then generally the advice is not to install packages direct into the base environment - in many cases, you should be managing that environment using a system package manager rather than pip anyway.

But if you do need to do that, a script such as the one @pradyunsg linked to, is probably the best way.

Yes, the script helps.

@uranusjr
Copy link
Member

I think one thing to note is deleting all (pip-)installed packages does not equal to blanking the environment, especially if the environment is shared (not isolated to one specific use case). If the environment is a virtual environment, a script wiping sys.prefix and recreating a virutal environment in-place is better in every way. If the goal is explicitly uninstalling all pip-installed packages, pip reset mis-describes what is actually done, and something like pip uninstall :all: would be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

4 participants