1187

How do I uninstall all packages installed by pip from my currently activated virtual environment?

Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135
blueberryfields
  • 45,910
  • 28
  • 89
  • 168
  • 57
    @patelshahrukh uninstalling python **DOES NOT** remove pip packages. please **AVOID** doing that, since it both most likely **WON'T WORK** the way you think it will, *and*, depending on how you install python again, can leave your machine in an unstable state that's **more work to fix**. – blueberryfields Apr 23 '18 at 18:23
  • 2
    this might help for packages installed in development mode or editable mode: https://stackoverflow.com/questions/17346619/how-to-uninstall-editable-packages-with-pip-installed-with-e – Charlie Parker May 02 '20 at 16:21

34 Answers34

1675

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

pip 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):

pip freeze | grep -v "^-e" | 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.

pip freeze | cut -d "@" -f1 | xargs pip uninstall -y
Siddharth Prajosh
  • 1,013
  • 2
  • 9
  • 16
blueberryfields
  • 45,910
  • 28
  • 89
  • 168
  • 15
    I find this a good solution, purely because it doesn't remove the virtual environment entirely - I may have made changes to e.g. `postactivate` which will remain. – niceguydave Jul 04 '13 at 08:17
  • 8
    After running this I realized it removed the `setuptools` package. I resolved the issue following instructions here: http://stackoverflow.com/questions/7446187/no-module-named-pkg-resources – Dan Mar 12 '14 at 00:37
  • 1
    @gerty3000 yes, this will (as the question asks) remove all of the packages installed in a virtual-env. in your environment, maybe setuptools would be better off installed at a global location instead? – blueberryfields Mar 13 '14 at 14:06
  • this is apprently what `wipeenv` of `virtualenvwrapper` does but it does not handle `-e` like this answer suggests. so how to uninstalle those VCS ones? – dashesy Jan 06 '15 at 17:51
  • I've noticed that pip fails early when a lib isn't already installed, so `for r in $(cat requirements.txt | grep -v ^#); do pip uninstall -y $r; done;` works in that case. – Pat Mar 04 '15 at 00:44
  • @Pat you're probably not running the pip freeze at the start; this command explicitly removes all the already installed packages (and not the ones that were meant to be installed/listed in requirements) – blueberryfields Apr 09 '15 at 14:58
  • @blueberryfields you're right, I wasn't. But that's because I didn't want to uninstall everything, I only wanted to uninstall libs that are listed in reqs.txt. Different use case, I guess :) – Pat Apr 10 '15 at 21:48
  • 1
    To speed up the uninstall (helps a lot if you have an SSD and a multicore processor): `pip freeze | grep -v "^-e" | xargs -L1 -P16 pip uninstall -y` – Wolph Feb 24 '16 at 19:38
  • Worked perfect. like a champ – Phares May 09 '18 at 06:54
  • 28
    You can also use `pip freeze --exclude-editable | xargs pip uninstall -y` to ignore VCS packages without using a grep pattern – Connor Brinton Jul 26 '18 at 21:15
  • 2
    I had to run `pip freeze | xargs -I {} pip uninstall -y {}` but otherwise this worked for me. – carbocation Oct 18 '18 at 16:00
  • @HarshadKavathiya use cygwin or gow – blueberryfields Nov 05 '18 at 17:32
  • 2
    And to uninstall editable packages see https://stackoverflow.com/questions/17346619 – Dan Oak Jul 06 '19 at 15:15
  • 2
    Does not work with Azure Notebooks: `ERROR: Cannot uninstall 'bitarray'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.` – SeaDude Apr 30 '20 at 07:07
  • 48
    `ERROR: Invalid requirement: '@'` I have packages that ive installed from my gitlab. – mRyan Jun 05 '20 at 12:22
  • 30
    `pip freeze` lists all packages, including those installed in the OS. User will is unable (and possibly does not want) to remove them without root permissions. `pip freeze --user` worked for me. – user1079505 Jun 12 '20 at 16:15
  • It has been suggested to me that your answer also answers my Q at https://stackoverflow.com/questions/65662158/fixing-python-packages-mis-installed-by-sudo-pip-sudo-pip3 Is this true, as I don't see sudo discussed here at all. – Elliptical view Jan 11 '21 at 16:25
  • VCS should be explained [here](https://github.com/dirk-thomas/vcstool) – Timo Jan 14 '21 at 18:25
  • Does it delete the pip package (which I want to keep) – Timo Jan 14 '21 at 18:26
  • 1
    I voted this up 2 years ago and here I am again, wishing I could vote this up one more time. :D – Luis Milanese Jun 11 '21 at 02:52
  • In case you have been looking to uninstall on multiple versions of python, use `py - -m pip freeze | xargs py - -m pip uninstall -y`. Make sure to add `py - -m` in both occurrences, if in case you add it only in the first, you would see something as `WARNING: Skipping as it is not installed.` – Shubham Srivastava Nov 14 '21 at 09:43
  • https://stackoverflow.com/a/67379806/1862590 This solution is provided to reset the virtual environment. –  Mar 23 '22 at 08:36
  • 13
    @mRyan `pip list --format=freeze |xargs pip uninstall -y` did the trick for me – skynet1010 Mar 23 '22 at 19:41
  • Warning: don't run this command in your base conda environment, it will remove packages required for conda itself to work. – someone Dec 01 '22 at 16:32
  • 1
    If you are using Windows, you can't run this in a command prompt because you don't have use xargs, cut, etc. However if you have git installed, you probably have git bash installed as well and you can run this command in a git bash shell – Andy May 12 '23 at 09:38
  • I run into a problem that `typing-extensions` becomes `typing_extensions` (note the `-` and `_`) after `pip freeze` in some versions of Python. Although both names are legal, this package will be uninstalled even if it is in `requirements.txt`. We need to match `_` against `-` before `grep`, maybe by ` | sed "s/_/-/g"`. – RoastDuck Jun 15 '23 at 07:13
853

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

pip freeze > requirements.txt

Now to remove one by one

pip uninstall -r requirements.txt

If we want to remove all at once then

pip 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

pip uninstall -y -r <(pip freeze)
Nam G VU
  • 33,193
  • 69
  • 233
  • 372
Harshad Kavathiya
  • 8,939
  • 1
  • 10
  • 19
205

I wanted to elevate this answer out of a comment section because it's one of the most elegant solutions in the thread. Full credit for this answer goes to @joeb.

pip uninstall -y -r <(pip freeze)

This worked great for me for the use case of clearing my user packages folder outside the context of a virtualenv which many of the above answers don't handle.

Edit: Anyone know how to make this command work in a Makefile?

Bonus: A bash alias

I add this to my bash profile for convenience:

alias pipuninstallall="pip uninstall -y -r <(pip freeze)"

Then run:

pipuninstallall

Alternative for Pipenv

If you are using pipenv, you can run:

pipenv uninstall --all

Alternative for Poetry

If you are using Poetry, run:

poetry env remove --python3.9

(Note that you need to change the version number there to match whatever your Python version is.)

Taylor D. Edmiston
  • 12,088
  • 6
  • 56
  • 76
  • I like it but it doesn't work in the null case (`pip freeze` results in nothing output if no packages installed, and then `pip uninstall` complains, unfortunately). – Eric G Aug 19 '18 at 23:53
  • Hmm good catch. Perhaps it could be wrapped into a bash function that checks whether the pip freeze output is non-empty. I don't see a great way to achieve that while keeping the command a nice short one-liner. – Taylor D. Edmiston Aug 20 '18 at 17:05
  • 2
    make uses sh by default, but the substitution syntax `<(...)` is a bashism. So you can either use bash -c "...", or work around by doing a `pip freeze | pip uninstall -r /dev/stdin` – Caesar Oct 08 '18 at 23:45
  • 2
    Does not work with Azure Notebooks: `ERROR: Cannot uninstall 'bitarray'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.` – SeaDude Apr 30 '20 at 07:03
  • @SeaDude Here is a workaround that may help - https://stackoverflow.com/questions/49915951/cannot-uninstall-chardet. If that doesn't work, then this approach would be my next best guess - https://github.com/vlachoudis/bCNC/issues/1141. Note that the packages mentioned are different, but I believe the underlying issue may be similar. – Taylor D. Edmiston May 01 '20 at 15:36
  • Add `SHELL := /usr/bin/env bash` at the top of your Makefile. See also https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html – Jens Aug 19 '22 at 02:19
  • Does not works on Windows `The system cannot find the file specified.` – Muhammad Yasirroni Nov 02 '22 at 02:01
154

This works with the latest. I think it's the shortest and most declarative way to do it.

virtualenv --clear MYENV

But why not just delete and recreate the virtualenv?

Immutability rules. Besides it's hard to remember all those piping and grepping the other solutions use.

Robert Moskal
  • 21,737
  • 8
  • 62
  • 86
  • 9
    Is this effectively the same as running `wipeenv`? http://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html#wipeenv – Taylor D. Edmiston Apr 15 '15 at 16:11
  • Actually — it seems (from what I just ran into) whereas `wipeenv` while within the environment throws an error and doesn't remove anything if used in the context of a `pip install -e` development build, attempting to use `virtualenv --clear MYENV` doesn't throw an error and removes none of the packages that you may have installed previously in the environment. At least this is the case on OSX. See https://bitbucket.org/dhellmann/virtualenvwrapper/issues/211/wipeenv-does-not-work-when-pip-install-e for further info. – mpacer Aug 04 '15 at 06:20
  • 4
    `wipeenv` is an alias provided by virtualenvwrapper, so not everyone has it. – Jonathan Hartley Oct 11 '17 at 17:29
  • 3
    well, this is kind of a dirty trick, but works like magic. I would prefer that everyone to use pip uninstall -r requirements.txt -y. It makes a great clean up. – Muema Mar 09 '18 at 19:25
69

I managed it by doing the following:

  1. Create the requirements file called reqs.txt with currently installed packages list
pip freeze > reqs.txt
  1. Then uninstall all the packages from reqs.txt
# -y means remove the package without prompting for confirmation
pip uninstall -y -r reqs.txt

I like this method as you always have a pip requirements file to fall back on should you make a mistake. It's also repeatable, and it's cross-platform (Windows, Linux, MacOs).

K-Dawg
  • 3,013
  • 2
  • 34
  • 52
67

Other answers that use pip list or pip freeze must include --local else it will also uninstall packages that are found in the common namespaces.

So here are the snippet I regularly use

 pip freeze --local | xargs pip uninstall -y

Ref: pip freeze --help

nehem
  • 12,775
  • 6
  • 58
  • 84
  • This worked until it hit a package that produced this error: `ERROR: Cannot uninstall 'bitarray'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.`. Then I couldn't uninstall any more modules. – SeaDude Apr 30 '20 at 07:02
45

Method 1 (with pip freeze)

pip freeze | xargs pip uninstall -y

Method 2 (with pip list)

pip list | awk '{print $1}' | xargs pip uninstall -y

Method 3 (with virtualenv)

virtualenv --clear MYENV
blueberryfields
  • 45,910
  • 28
  • 89
  • 168
Suriyaa
  • 2,222
  • 2
  • 25
  • 44
  • 2
    sudo is not necessary, and quite probably dangerous to use without careful consideration, since it affects the global machine setup. see this answer for example: http://stackoverflow.com/questions/15028648/is-it-acceptable-safe-to-run-pip-install-under-sudo – blueberryfields Jun 09 '16 at 02:16
  • 8
    Method 2 (`pip list`) works great until you have pip accidentally uninstall itself -_- – Justin Feb 24 '17 at 00:48
  • Method 2 didn't work in my case because there is a header in the list which needs to be ignored. This one worked: `pip list | awk '{print $1}' | grep -vE "^pip$|^Package$|^---" | xargs pip uninstall -y` – Menda Feb 21 '22 at 16:32
39

On Windows if your path is configured correctly, you can use:

pip freeze > unins && pip uninstall -y -r unins && del unins

It should be a similar case for Unix-like systems:

pip freeze > unins && pip uninstall -y -r unins && rm unins

Just a warning that this isn't completely solid as you may run into issues such as 'File not found' but it may work in some cases nonetheless

EDIT: For clarity: unins is an arbitrary file which has data written out to it when this command executes: pip freeze > unins

That file that it written in turn is then used to uninstall the aforementioned packages with implied consent/prior approval via pip uninstall -y -r unins

The file is finally deleted upon completion.

31

I use the --user option to uninstall all the packages installed in the user site.

pip3 freeze --user | xargs pip3 uninstall -y
Kermit
  • 4,922
  • 4
  • 42
  • 74
Dean
  • 537
  • 4
  • 8
  • I believe this answer doesn't add much new information, I would rather have suggested an improvement to another already existing similar answer such as this one: https://stackoverflow.com/a/45475070/11138259 – sinoroc Apr 03 '20 at 14:15
  • 1
    If you are using a virtualenv and get `ERROR: You must give at least one requirement to uninstall`, remove the --user part – Checo R Nov 29 '20 at 20:13
  • `pip3 freeze | xargs pip3 uninstall -y` ==> ` PermissionError: [Errno 13] Permission denied: '/usr/local/bin/ap' -> '/tmp/pip-uninstall-q9gzbj0d/ap'` – SL5net Feb 28 '21 at 12:48
  • 1
    @SL5net. You might need to run it as superuser. Something like sudo sh -c 'pip3 freeze | xargs pip3 uninstall -y' (The added sh -c and quotes are because pipe doesnt tend to play nicely with sudo) Or you could just do your command as root, but I dont recomend that as its not a great habit to be in. shelling about in root makes it pretty easy to accidently murder your system, trust me, bitter experience talking here. – Shayne Jun 15 '21 at 13:32
  • Good point of `--user` option. Because `--local` lists *all* packages installed locally, not user ones. – somenxavier Jan 03 '23 at 13:57
23

For Windows users, this is what I use on Windows PowerShell

 pip uninstall -y (pip freeze)
benwrk
  • 368
  • 2
  • 7
21

First, add all package to requirements.txt

pip freeze > requirements.txt

Then remove all

pip uninstall -y -r requirements.txt 
shafik
  • 6,098
  • 5
  • 32
  • 50
19

The quickest way is to remake the virtualenv completely. I'm assuming you have a requirements.txt file that matches production, if not:

# On production:
pip freeze > reqs.txt

# On your machine:
rm $VIRTUALENV_DIRECTORY
mkdir $VIRTUALENV_DIRECTORY
pip install -r reqs.txt
Dan Loewenherz
  • 10,879
  • 7
  • 50
  • 81
Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
  • 2
    Does this even handle the case where there was a editable install (basically a setuptools develop mode install) that created a local .egg-info file that then interfered with the rest of the installation/uninstallation process? Since it's a set of files it doesn't seem to know how to handle their presence, and rather than uninstalling anything it makes a local directory structure under MYENV complete with: ` > New python executables in MYENV/bin/python3.4 > Also creating executable in MYENV/bin/python > Installing setuptools, pip, wheel...done.` But MYENV hasn't reset the environment! – mpacer Aug 04 '15 at 06:35
19

Best way to remove all packages from the virtual environment.

Windows PowerShell:

pip freeze > unins ; pip uninstall -y -r unins ; del unins

Windows Command Prompt:

pip freeze > unins && pip uninstall -y -r unins && del unins

Linux:

pip3 freeze > unins ; pip3 uninstall -y -r unins ; rm unins
Sathiamoorthy
  • 8,831
  • 9
  • 65
  • 77
16

Using virtualenvwrapper function:

wipeenv

See wipeenv documentation

GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
zesk
  • 307
  • 2
  • 6
  • 6
    If you are using virtualenvwrapper, type [```wipeenv```](http://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html#managing-installed-packages) – raratiru Oct 24 '16 at 19:22
13

Its an old question I know but I did stumble across it so for future reference you can now do this:

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

-r, --requirement file

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

from the pip documentation version 8.1

Craicerjack
  • 6,203
  • 2
  • 31
  • 39
6

(adding this as an answer, because I do not have enough reputation to comment on @blueberryfields 's answer)

@blueberryfields 's answer works well, but fails if there is no package to uninstall (which can be a problem if this "uninstall all" is part of a script or makefile). This can be solved with xargs -r when using GNU's version of xargs:

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

from man xargs:

-r, --no-run-if-empty

If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input. This option is a GNU extension.

6
pip3 freeze --local | xargs pip3 uninstall -y

The case might be that one has to run this command several times to get an empty pip3 freeze --local.

obotezat
  • 1,041
  • 16
  • 20
5
pip uninstall `pip freeze --user`

The --user option prevents system-installed packages from being included in the listing, thereby avoiding /usr/lib and distutils permission errors.

young_souvlaki
  • 1,886
  • 4
  • 24
  • 28
2

This was the easiest way for me to uninstall all python packages.

from pip import get_installed_distributions
from os import system
for i in get_installed_distributions():
    system("pip3 uninstall {} -y -q".format(i.key))
Huey
  • 5,110
  • 6
  • 32
  • 44
2

the easy robust way cross-platform and work in pipenv as well is:

pip freeze 
pip uninstall -r requirement

by pipenv:

pipenv run pip freeze 
pipenv run pip uninstall -r requirement

but won't update piplock or pipfile so be aware

Mahdi Hamzeh
  • 289
  • 2
  • 8
2

This works on my windows system

pip freeze > packages.txt && pip uninstall -y -r packages.txt && del packages.txt

The first part pip freeze > packages.txt creates a text file with list of packages installed using pip along with the version number

The second part pip uninstall -y -r packages.txt deletes all the packages installed without asking for a confirmation prompt.

The third part del packages.txt deletes the just now created packages.txt.

SohailAQ
  • 1,002
  • 1
  • 13
  • 25
2

This worked for me on Windows:

pip uninstall -y (pip freeze)
Dinesh Roy
  • 141
  • 4
  • 12
1

Cross-platform support by using only pip:

#!/usr/bin/env python

from sys import stderr
from pip.commands.uninstall import UninstallCommand
from pip import get_installed_distributions

pip_uninstall = UninstallCommand()
options, args = pip_uninstall.parse_args([
    package.project_name
    for package in
    get_installed_distributions()
    if not package.location.endswith('dist-packages')
])

options.yes = True  # Don't confirm before uninstall
# set `options.require_venv` to True for virtualenv restriction

try:
    print pip_uninstall.run(options, args)
except OSError as e:
    if e.errno != 13:
        raise e
    print >> stderr, "You lack permissions to uninstall this package.
                      Perhaps run with sudo? Exiting."
    exit(13)
# Plenty of other exceptions can be thrown, e.g.: `InstallationError`
# handle them if you want to.
Samuel Marks
  • 1,611
  • 1
  • 20
  • 25
1

On Windows if your path is configured correctly, you can use:

pip freeze > unins && pip uninstall -y -r unins && del unins
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
1

Why not just rm -r .venv and start over?

Evan Zamir
  • 8,059
  • 14
  • 56
  • 83
0

This is the command that works for me:

pip list | awk '{print $1}' | xargs pip uninstall -y
Fei Xie
  • 107
  • 1
  • 2
0

If you're running virtualenv:

virtualenv --clear </path/to/your/virtualenv>

for example, if your virtualenv is /Users/you/.virtualenvs/projectx, then you'd run:

virtualenv --clear /Users/you/.virtualenvs/projectx

if you don't know where your virtual env is located, you can run which python from within an activated virtual env to get the path

punkrockpolly
  • 9,270
  • 6
  • 36
  • 37
0

In Command Shell of Windows, the command pip freeze | xargs pip uninstall -y won't work. So for those of you using Windows, I've figured out an alternative way to do so.

  1. Copy all the names of the installed packages of pip from the pip freeze command to a .txt file.
  2. Then, go the location of your .txt file and run the command pip uninstall -r *textfile.txt*
Sushant Rajbanshi
  • 1,985
  • 1
  • 19
  • 20
0

If you are using pew, you can use the wipeenv command:

pew wipeenv [env]

Mohammad Banisaeid
  • 2,376
  • 27
  • 35
0

I simply wanted to remove packages installed by the project, and not other packages I've installed (things like neovim, mypy and pudb which I use for local dev but are not included in the app requirements). So I did:

cat requirements.txt| sed 's/=.*//g' | xargs pip uninstall -y

which worked well for me.

verboze
  • 419
  • 1
  • 7
  • 10
0

Select Libraries To Delete From This Folder:

C:\Users\User\AppData\Local\Programs\Python\Python310\Lib\site-packages

0

You can use a simple loop to remove all packages installed by pip.

Here is the command for Windows:

for /f "delims=" %i in ('pip freeze') do pip uninstall -y "%i"

%i is used as a loop variable, and you should run this command in the same directory where pip is located, or you can provide the full path to pip if it's not in your system's PATH.

S.B
  • 13,077
  • 10
  • 22
  • 49
Boudribila
  • 51
  • 4
-1

Pip has no way of knowing what packages were installed by it and what packages were installed by your system's package manager. For this you would need to do something like this

for rpm-based distros (replace python2.7 with your python version you installed pip with):

find /usr/lib/python2.7/ |while read f; do
  if ! rpm -qf "$f" &> /dev/null; then
    echo "$f"
  fi
done |xargs rm -fr

for a deb-based distribution:

find /usr/lib/python2.7/ |while read f; do
  if ! dpkg-query -S "$f" &> /dev/null; then
    echo "$f"
  fi
done |xargs rm -fr

then to clean up empty directories left over:

find /usr/lib/python2.7 -type d -empty |xargs rm -fr

I found the top answer very misleading since it will remove all (most?) python packages from your distribution and probably leave you with a broken system.

glenda
  • 58
  • 2
  • With all due respect, this seems comparable. Why not `dpkg-query -S '/usr/lib/python2.7/*'`, extract the names, and `dpkg-query -L` each name to dump the associated files? It already has the manifests prepared. My main objection is that instead of targeting packages installed anywhere but by pip, you've targeted packages installed by anything other than the manager you expect, and in a location that pip generally shouldn't be touching. `pip list -l` lists the packages it installed locally, and some will even `pip install --target=...`. Removing all currently empty dirs will bite you too! – John P Jan 22 '18 at 06:36
-2

In my case, I had accidentally installed a number of packages globally using a Homebrew-installed pip on macOS. The easiest way to revert to the default packages was a simple:

$ brew reinstall python

Or, if you were using pip3:

$ brew reinstall python3
Resigned June 2023
  • 4,638
  • 3
  • 38
  • 49
  • This answer assumes too much about the environment and doesn't directly solve the problem if you are using pyenv for example. – Mark Jul 22 '17 at 14:01
  • @Mark Well sure if you're using pyenv, then you would need to do something different. In the common case that you're not, I believe this is the simplest and least hacky solution. Note that this condition is explicitly stated at the beginning of the answer. – Resigned June 2023 Jul 23 '17 at 05:54
  • The OP asked about virtualenvs. He made no specific mention of using a Mac or brew to install Python. Therefore you cannot assume the OS or brew was used - and this answer will not solve ALL conditions. If you focus on solving for the environment using a tool such as pip - you will address the context of the environment you are within. Hope that makes sense. – Mark Jul 23 '17 at 10:57
  • 3
    @Mark I understand your position. We can agree to disagree. I just want to help out the people from Google who click on a link labelled "What is the easiest way to remove all packages installed by pip?" when they really want to remove all packages installed *globally* by pip. – Resigned June 2023 Jul 23 '17 at 16:25
  • 1
    Agreed with @RadonRosborough, the link title is representative of why I landed here, even if the OP does not actually ask the same question. – Kenn Sebesta Jul 31 '17 at 21:31