3 Ways to Remove All Packages Installed by Pip
Pip uninstall all is used for removing packages and dependencies
3 min. read
Updated on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
Key notes
- Pip uninstall helps you remove unnecessary packages from Python.
- Removing the pip packages from the Python environment will aid in unclustering them
Over time, as you work on various Python projects, your environment may become cluttered with multiple packages. So, using pip to uninstall all packages can help resolve it.
Therefore, we will explore ways to remove all packages installed by pip to have a clean Python environment. Also, we have a detailed guide about how to install pip on macOS in simple steps.
What is pip?
Pip is a package management system for installing and managing software packages written in Python. It stands for Pip Installs Packages or Pip Installs Python. Pip is the standard package installer for Python and is widely used in the Python community.
Here are some of the main functions of pip:
- Pip lets you easily install Python packages from the Python Package Index (PyPI) or other sources.
- It automatically resolves and installs the dependencies required by a package.
- Pip enables you to manage installed packages, including upgrading, downgrading, or uninstalling them.
- You can search PyPI to discover available Python packages and their versions.
- It helps you manage package versions, allowing you to specify the desired version or range of versions for installation.
- Pip provides tools for packaging and distributing Python packages, making it easier to share your own code with others.
- It integrates well with virtual environments, allowing you to isolate and manage dependencies for different projects.
- Pip can be used to upgrade its own version to the latest release.
What does pip uninstall do?
As its name says, pip uninstall is in charge of uninstalling Python packages. However, it can’t remove the following:
- Pure distutils packages that leave no metadata
- Script wrappers
How can I pip uninstall all packages in Windows?
1. Uninstall the individual package
- Press the Windows button, type Command Prompt, and select Run as Administrator to open it.
- Type the following and press Enter to know the list of packages installed:
pip list
- Then, type this and press Enter:
pip uninstall package_name
Using the command above will uninstall the particular package name entered. Note: substitute the package name with the individual package you want to remove.
You can read our guide about how to fix Command Prompt not working on your PC.
2. Remove all packages
- Press the Windows button, type Command Prompt, and select Run as Administrator to open it.
- Type the following and press Enter:
pip uninstall -y -r <(pip freeze)
- Reply with the following and press Enter to confirm your selection:
Y
Adding the pip freeze command will remove all packages installed on your system by pip.
3. Remove all packages using use xargs
- Press the Windows button, type Command Prompt, and select Run as Administrator to open it.
- Type the following in the command prompt and press Enter:
pip freeze | xargs pip uninstall -y
- THen, input this code and press Enter to exclude the VCS package:
pip freeze | grep -v "^-e" | xargs pip uninstall -y
- Type the following and press Enter:
pip freeze --user | xargs pip uninstall -y
You can only individually remove packages installed from VCS (version control systems). Thus, you will have to exclude them before the command can run.
In conclusion, check our detailed guide about resolving PIP not recognized in PyCharm terminus on Windows OS. Also, we have a complete guide on Visual Studio vs PyCharm to help you decide which IDE is best for your next project.
Should you have further questions or suggestions regarding this guide, kindly drop them in the comments section.
User forum
1 messages