🌐
pip
pip.pypa.io › en › stable › cli › pip_uninstall
pip uninstall - pip documentation v26.1.2
python -m pip uninstall [options] <package> ... python -m pip uninstall [options] -r <requirements file> ...
Discussions

python - How to uninstall a package installed with pip install --user - Stack Overflow
There is a --user option for pip which can install a Python package per user: pip install --user [python-package-name] I used this option to install a package on a server for which I do not have r... More on stackoverflow.com
🌐 stackoverflow.com
How do you remove pip from a pc if you installed by "get-pip.py"
removing, uninstalling pip get-pip.py from here Cant find anything on this subject. Might be helpful for the documentation as well More on github.com
🌐 github.com
8
June 24, 2014
How to uninstall all Python packages installed with pip?
I used chatgpt and it gave me this command which worked for me "pip freeze > installed_packages.txt pip uninstall -r installed_packages.txt -y del installed_packages.txt " More on reddit.com
🌐 r/learnpython
14
6
September 26, 2020
python - How do I remove all packages installed by pip? - Stack Overflow
How do I uninstall all packages installed by pip from my currently activated virtual environment? ... @patelshahrukh uninstalling python DOES NOT remove pip packages. More on stackoverflow.com
🌐 stackoverflow.com
Top answer
1 of 7
267

Having tested this using Python 3.5 and pip 7.1.2 on Linux, the situation appears to be this:

  • pip install --user somepackage installs to $HOME/.local, and uninstalling it does work using pip uninstall somepackage.

  • This is true whether or not somepackage is also installed system-wide at the same time.

  • If the package is installed at both places, only the local one will be uninstalled. To uninstall the package system-wide using pip, first uninstall it locally, then run the same uninstall command again, with root privileges.

  • In addition to the predefined user install directory, pip install --target somedir somepackage will install the package into somedir. There is no way to uninstall a package from such a place using pip. (But there is a somewhat old unmerged pull request on Github that implements pip uninstall --target.)

  • Since the only places pip will ever uninstall from are system-wide and predefined user-local, you need to run pip uninstall as the respective user to uninstall from a given user's local install directory.

2 of 7
23

Be careful though, for those who using pip install --user some_pkg inside a virtual environment.

Copy$ path/to/python -m venv ~/my_py_venv
$ source ~/my_py_venv/bin/activate
(my_py_venv) $ pip install --user some_pkg
(my_py_venv) $ pip uninstall some_pkg
WARNING: Skipping some_pkg as it is not installed.
(my_py_venv) $ pip list
# Even `pip list` will not properly list the `some_pkg` in this case

In this case, you have to deactivate the current virtual environment, then use the corresponding python/pip executable to list or uninstall the user site packages:

Copy(my_py_venv) $ deactivate
$ path/to/python -m pip list
$ path/to/python -m pip uninstall some_pkg

Note that this issue was reported few years ago. And it seems that the current conclusion is: --user is not valid inside a virtual env's pip, since a user location doesn't really make sense for a virtual environment.

🌐
MTU Service Desk
servicedesk.mtu.edu › TDClient › 1801 › Portal › KB › ArticleDet
Installing, uninstalling, or upgrading Python modules using Pip (Linux)
Use the command 'pip3 uninstall <package-name>'. Depending on how the package was installed, you may need to replace the pip3 command with the version of Pip that was used to originally install the package.
🌐
MiniTool
minitool.com › home › news › pip uninstall all python packages in windows – see a full guide!
PIP Uninstall All Python Packages in Windows, Learn Essentials
November 26, 2024 - 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 ...
Find elsewhere
🌐
GitHub
github.com › pypa › pip › issues › 1892
How do you remove pip from a pc if you installed by "get-pip.py" · Issue #1892 · pypa/pip
June 24, 2014 - removing, uninstalling pip get-pip.py from here Cant find anything on this subject. Might be helpful for the documentation as well
Author   pypa
🌐
iO Flood
ioflood.com › blog › pip-uninstall
Learn 'pip uninstall': Guide to Python Package Removal
January 30, 2024 - ... In this example, we’ve used ‘pip uninstall’ followed by the name of the package we want to remove, in this case, ‘numpy’. The command prompts the system to find and remove the specified package.
🌐
Reddit
reddit.com › r/learnpython › how to uninstall all python packages installed with pip?
r/learnpython on Reddit: How to uninstall all Python packages installed with pip?
September 26, 2020 -

I have recently installed Python on my new computer. Although my intension was to make a virtual environment for every project, I somehow forgot to activate one before installing a bunch of packages. Now, every time I create a new virtual environment, all these packages are already there.

I have tried to use --no-site-packages, but later found out that this flag isn't working anymore. Not sure what I should do now. Should I uninstall pip? What am I missing?

B/w, when trying to run pip3 uninstall -r reqs.txt -y I get errors like this:

Found existing installation: appdirs 1.4.3

Not uninstalling appdirs at /usr/lib/python3/dist-packages, outside environment /usr

Can't uninstall 'appdirs'. No files were found to uninstall.

Found existing installation: apturl 0.5.2

Not uninstalling apturl at /usr/lib/python3/dist-packages, outside environment /usr

Can't uninstall 'apturl'. No files were found to uninstall.

Found existing installation: blinker 1.4

Not uninstalling blinker at /usr/lib/python3/dist-packages, outside environment /usr

Can't uninstall 'blinker'. No files were found to uninstall.

Thanks for your help!

🌐
dbader.org
dbader.org › blog › install-and-uninstall-python-packages-using-pip
How to Install and Uninstall Python Packages Using Pip – dbader.org
July 25, 2017 - Running the following command will ... command works by first listing all installed packages using the freeze command, and then feeding the list of packages into the pip uninstall command to remove them....
🌐
Readthedocs
pip-python3.readthedocs.io › en › latest › reference › pip_uninstall.html
pip uninstall — pip 10.0.0.dev0 documentation
... Don’t ask for confirmation of uninstall deletions. Uninstall a package. $ pip uninstall simplejson Uninstalling simplejson: /home/me/env/lib/python2.7/site-packages/simplejson /home/me/env/lib/python2.7/site-packages/simplejson-2.2.1-py2.7.egg-info Proceed (y/n)?
🌐
Lindevs
lindevs.com › uninstall-python-packages-using-pip
Uninstall Python Packages using pip | Lindevs
January 20, 2025 - If you need to remove specific packages, you can do so by directly specifying the package names in the pip uninstall command: ... The -y option confirms the uninstallation without prompting for each package.
🌐
TutorialsPoint
tutorialspoint.com › How-to-delete-an-installed-module-in-Python
How to delete an installed module in Python?
November 23, 2022 - Use pip uninstall for standard Python packages and conda uninstall for Anaconda environments.
🌐
pip
pip.pypa.io › en › latest › cli › pip_uninstall
pip uninstall - pip documentation v26.2.dev0
python -m pip uninstall [options] <package> ... python -m pip uninstall [options] -r <requirements file> ...
🌐
Local Host
locall.host › home › uninstall › master the uninstallation: a comprehensive guide to removing python packages with pip
Master the Uninstallation: A Comprehensive Guide to Removing Python Packages with PIP
August 10, 2023 - Step 3: Uninstall the Python package Once you’ve identified the package you want to remove, use the following command to uninstall it: ... Replace *package_name* with the actual name of the package you want to uninstall. For example, if you want to uninstall a package called “example-p...
Top answer
1 of 16
1992

I've found this snippet as an alternative solution. It's a more graceful removal of libraries than remaking the virtualenv:

Copypip freeze | xargs pip uninstall -y

In case you have packages installed via VCS, you need to exclude those lines and remove the packages manually (elevated from the comments below):

Copypip freeze --exclude-editable | xargs pip uninstall -y

If you have packages installed directly from github/gitlab, those will have @. Like:

django @ git+https://github.com/django.git@<sha>

You can add cut -d "@" -f1 to get just the package name that is required to uninstall it.

Copypip freeze | cut -d "@" -f1 | xargs pip uninstall -y
2 of 16
1032

This will work for all Mac, Windows, and Linux systems. To get the list of all pip packages in the requirements.txt file (Note: This will overwrite requirements.txt if exist else will create the new one, also if you don't want to replace old requirements.txt then give different file name in the all following command in place requirements.txt).

Copypip freeze > requirements.txt

Now to remove one by one

Copypip uninstall -r requirements.txt

If we want to remove all at once then

Copypip uninstall -r requirements.txt -y

If you're working on an existing project that has a requirements.txt file and your environment has diverged, simply replace requirements.txt from the above examples with toberemoved.txt. Then, once you have gone through the steps above, you can use the requirements.txt to update your now clean environment.

And For single command without creating any file as @joeb suggested

Copypip uninstall -y -r <(pip freeze)
🌐
W3Schools
w3schools.com › python › gloss_python_pip_packages_remove.asp
Python PIP Remove Package
The PIP Package Manager will ask you to confirm that you want to remove the camelcase package: Uninstalling camelcase-02.1: Would remove: c:\users\Your Name\appdata\local\programs\python\python36-32\lib\site-packages\camecase-0.2-py3.6.egg-info c:\users\Your Name\appdata\local\programs\python\python36-32\lib\site-packages\camecase\* Proceed (y/n)?
🌐
Note.nkmk.me
note.nkmk.me › home › python
How to Use pip (Install, Update, Uninstall Packages) | note.nkmk.me
April 18, 2025 - $ pip uninstall --yes <package-name> $ pip uninstall -y <package-name> Use pip show to check details of installed packages. ... For example, pip itself is one of the packages, so its details can be checked as follows.