Pip uninstall all packages windows

View this page

Toggle table of contents sidebar

Usage¶

Unix/macOS

python -m pip uninstall [options] <package> ...
python -m pip uninstall [options] -r <requirements file> ...

Windows

py -m pip uninstall [options] <package> ...
py -m pip uninstall [options] -r <requirements file> ...

Description¶

Uninstall packages.

pip is able to uninstall most installed packages. Known exceptions are:

  • Pure distutils packages installed with python setup.py install, which
    leave behind no metadata to determine what files were installed.

  • Script wrappers installed by python setup.py develop.

Options¶

-r, —requirement <file>

Uninstall all the packages listed in the given requirements file. This option can be used multiple times.

(environment variable: PIP_REQUIREMENT)

-y, —yes

Don’t ask for confirmation of uninstall deletions.

(environment variable: PIP_YES)

—root-user-action <root_user_action>

Action if pip is run as a root user [warn, ignore] (default: warn)

(environment variable: PIP_ROOT_USER_ACTION)

—break-system-packages

Allow pip to modify an EXTERNALLY-MANAGED Python installation

(environment variable: PIP_BREAK_SYSTEM_PACKAGES)

Examples¶

  1. Uninstall a package.

    Unix/macOS

    $ python -m pip uninstall simplejson
    Uninstalling simplejson:
       /home/me/env/lib/python3.9/site-packages/simplejson
       /home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
    Proceed (Y/n)? y
       Successfully uninstalled simplejson
    

    Windows

    C:\> py -m pip uninstall simplejson
    Uninstalling simplejson:
       /home/me/env/lib/python3.9/site-packages/simplejson
       /home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
    Proceed (Y/n)? y
       Successfully uninstalled simplejson
    

  • Home
  • News
  • PIP Uninstall All Python Packages in Windows – See a Full Guide!

PIP Uninstall All Python Packages in Windows – See a Full Guide!

By Vera | Follow |
Last Updated

If you have installed a Python package, you want to uninstall it due to some reason. Then, how to uninstall Python package with PIP? After reading this detailed guide on PIP uninstall given by MiniTool, you know what you should do.

What Is PIP?

Before introducing something on how to uninstall PIP packages, let’s first see a general introduction to Python PIP.

PIP is a package manager in Python that is used to install and manage Python packages. This tool allows you to install and manage Python applications and their dependencies. Package management is very important, so PIP is pre-installed in most Python distributions. By default, Python 3.4 and later & Python 2.7.9 and later (on the Python2 series) include PIP.

If you install a Python package, due to some reason, you may want to uninstall it. Well then, how to uninstall Python package with PIP? Follow the guide here now to know some details.

Tips:

Experience a faster system with MiniTool System Booster – your solution to effortless program uninstallation.

MiniTool System Booster TrialClick to Download100%Clean & Safe

PIP Uninstall Package – How to Do in Windows

In this part, we show you some commands to uninstall PIP packages, and let’s see them one by one.

PIP Uninstall Packagename

Using this command, you can remove the installed package one by one. This method only works when you have already added Python to the Windows path. If you don’t know how to add it, you can go to press Win + R, type sysdm.cpl and click OK to open System Properties. Go to Advanced > Environment Variables. Under User variables, click New, and edit Variable name and Variable value.

In terms of Variable value, it should include the Python application path and Python Scripts path. To find them, right-click on your Python app (which can be found via the Windows search bar) and choose Open file location. Then, right-click on the Python shortcut and choose Open file location. The app path can be seen like C:\Users\cy\AppData\Local\Programs\Python\Python311. The Scripts path should be C:\Users\cy\AppData\Local\Programs\Python\Python311\Scripts.

add Python to Windows path

Next, see how to uninstall PIP.

Step 1: In Windows, open Command Prompt with admin rights.

Step 2: Type cd\ into the CMD window and press Enter.

Step 3: Type cd followed by the Python Scripts path and here is an example – cd C:\Users\cy\AppData\Local\Programs\Python\Python311\Scripts. Then, press Enter.

Step 4: Execute this command – pip uninstall package_name. Replace the package name with the one you have installed like pandas. See an example pip uninstall pandas.

PIP uninstall package

Step 5: Type y to confirm the uninstallation when asked. Now, your Python package is removed from your computer.

PIP Uninstall All Packages

If you want to delete all the packages installed by PIP, you can use the pip freeze command. It can help you list all the installed packages via PIP and uninstall them without asking for confirmation. The correct type of this command is pip uninstall -y -r <(pip freeze).

If you want, you can save the installed packages in a file called requirements.txt and directly uninstall PIP packages from the file. Run these commands:

pip freeze > requirements.txt

pip uninstall -r requirements.txt This helps to uninstall packages one by one.

pip uninstall -r requirements.txt -y This helps to delete all the packages at once.

In addition to pip freeze, you can also use xargs to uninstall all the PIP packages. The command is pip freeze | xargs pip uninstall -y. If you have packages installed via VCS (like GitLab, Github, Bitbucket, etc.), you need to exclude them and then uninstall Python packages with PIP via this command – pip freeze | grep -v “^-e” | xargs pip uninstall -y.

Final Words

How to uninstall Python package with PIP or how to uninstall PIP packages? After reading this guide on PIP uninstall, try the given ways to easily remove packages from your Windows computer if you need. If you have any ideas, let us know in the comment part.

About The Author

Position: Columnist

Vera is an editor of the MiniTool Team since 2016 who has more than 7 years’ writing experiences in the field of technical articles. Her articles mainly focus on disk & partition management, PC data recovery, video conversion, as well as PC backup & restore, helping users to solve some errors and issues when using their computers. In her spare times, she likes shopping, playing games and reading some articles.


Readers help support Windows Report. We may get a commission if you buy through our links.

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

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

  1. Press the Windows button, type Command Prompt, and select Run as Administrator to open it.
  2. Type the following and press Enter to know the list of packages installed: pip list
  3. 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

  1. Press the Windows button, type Command Prompt, and select Run as Administrator to open it.
  2. Type the following and press Enter: pip uninstall -y -r <(pip freeze)

  3. 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.

Read more about this topic

  • Meta under fire after AI chatbot caught having sexual talks with minors
  • OpenAI decides to reverse recent GPT-4o update after user find bot being overly appeasing
  • Microsoft’s hotpatching for Windows Server 2025 to be subscription-based starting July
  • South Korea’s antitrust watchdog green lights Microsoft’s practice of bundling Copilot
  • Microsoft wants Windows 10 users to upgrade to Windows 11 or Copilot + PCs

3. Remove all packages using use xargs

  1. Press the Windows button, type Command Prompt, and select Run as Administrator to open it.
  2. Type the following in the command prompt and press Enter: pip freeze | xargs pip uninstall -y
  3. THen, input this code and press Enter to exclude the VCS package: pip freeze | grep -v "^-e" | xargs pip uninstall -y

  4. 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.


Henderson Jayden Harper

Windows Software Expert

Passionate about technology, Crypto, software, Windows, and everything computer-related, he spends most of his time developing new skills and learning more about the tech world.

He also enjoys gaming, writing, walking his dog, and reading and learning about new cultures. He also enjoys spending private time connecting with nature.


Пройдите тест, узнайте какой профессии подходите

Существует множество случаев, когда может возникнуть необходимость удалить все пакеты, установленные через pip в рамках определенного виртуального

Освойте Python на курсе от Skypro. Вас ждут 400 часов обучения и практики (достаточно десяти часов в неделю), подготовка проектов для портфолио, индивидуальная проверка домашних заданий и помощь опытных наставников. Получится, даже если у вас нет опыта в IT.

Существует множество случаев, когда может возникнуть необходимость удалить все пакеты, установленные через pip в рамках определенного виртуального окружения. Например, это может быть полезно при переходе к новой версии Python или при необходимости «почистить» рабочее пространство для нового проекта.

Чтобы удалить все пакеты, установленные через pip, можно использовать команду pip freeze, которая выводит список всех установленных пакетов, а затем передать вывод этой команды в pip uninstall с использованием параметра -y, который автоматически подтверждает удаление каждого пакета.

В общем виде команда выглядит так:

pip freeze | xargs pip uninstall -y

Она работает следующим образом:

  • pip freeze создает список всех установленных пакетов.
  • xargs берет этот список и передает каждый элемент в качестве аргумента для следующей команды.
  • pip uninstall -y удаляет каждый пакет, переданный ей xargs.

Эта команда должна быть выполнена в активированном виртуальном окружении, из которого требуется удалить пакеты. Если виртуальное окружение не активировано, эта команда удалит пакеты из глобального пространства Python, что, скорее всего, не является желаемым действием.

Важно отметить, что эта команда удалит все пакеты, включая pip, поэтому после ее выполнения может потребоваться повторная установка pip или других необходимых пакетов.

На курсе Skypro «Python-разработчик» освоите основные инструменты программирования, получите опыт на реальных проектах и сможете стартовать в профессии уверенным новичком. Преподаватели — практикующие программисты с большим опытом, а в центре карьеры помогут составить цепляющее резюме и подготовиться к собеседованию.

How To Remove all Python packages installed by pip?


This post explains — How To Remove all Python packages installed by pip. To do that lets try the below  

Option 1:


Use below command —


pip freeze | xargs pip uninstall -y

 

Option 2:


If there are any packages which were installed usig VCS,  then we will exclude those . And then will remove the packages


pip freeze | grep -v "^-e" | xargs pip uninstall -y

 

Option 3:


  • Get the list of all Python pip package in the requirements.txt file — Note: This OVERWRITES the Existing requirements.txt else will create new one.

pip freeze > requirements.txt

  • Remove all packages — one by one

pip uninstall -r requirements.txt

  • Remove all packages at once —

pip uninstall -r requirements.txt -y

  Hope This post helps to explain — How To Remove all Python packages installed by pip.   Additional Reads:

  • How To Set up Apache Spark & PySpark in Windows 10
  • How To Save & Reload a Python Machine Learning Model using Pickle ?

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Huawei browser for windows
  • Настройка windows server 2012 r2 с нуля пошагово для чайников
  • No module named pil windows
  • Не удалось запустить службу windows audio на локальный компьютер 0x80070003
  • Как добавить telnet в windows server