Skip to content Skip to sidebar Skip to footer

Is There A Way To Uninstall Multiple Packages With Pip?

I am attempting to remove all of the installed 'pyobjc-framework'-prefixed packages. I have tried the following: % pip freeze | grep pyobjc-framework | xargs pip uninstall but th

Solution 1:

Your command should actually work if you add the -y | --yes flag to pip :-)

-y, --yes Don't ask for confirmation of uninstall deletions.

Possibly:

% pip freeze | grep pyobjc-framework | xargs pip uninstall -y

Solution 2:

Redirect the grep output to a new file and run.

 pip uninstall -r <filename>

works I think.

pip freeze | grep pyobjc > packages_to_remove.txt
sudo pip uninstall -y -r packages_to_remove.txt

Solution 3:

I always use this:

pip freeze | xargs pip uninstall -y

Solution 4:

Just prepare those packages as list:

pip uninstall <list of requirement> -y
e.g.:
pip uninstall  termcolor, imgviz, matplotlib, PyYAML, qtpy, Pillow, colorama, PyQt5, numpy -y

For example: Uninstall package with its dependence with pip in three steps:

  1. show dependence list
  2. remove the package
  3. remove list of its dependence (copy it from 1.)
For detail:
 1. pip show <package>    e.g.:
    pip show labelme
    ...
    Requires: termcolor, imgviz, matplotlib, PyYAML, qtpy, Pillow, colorama, PyQt5, numpy
    ...
 2. pip uninstall <package>    e.g.
    pip uninstall labelme
 3. pip uninstall <listofrequirement> -y
    e.g.:
    pip uninstall  termcolor, imgviz, matplotlib, PyYAML, qtpy, Pillow, colorama, PyQt5, numpy -y

Solution 5:

Easiest way. use remove all torch related packages for example:

pip uninstall `pip freeze | grep torch`

Post a Comment for "Is There A Way To Uninstall Multiple Packages With Pip?"