How to uninstall pip on OSX?


I ran the following commands:

easy_install pip
sudo pip install setuptools --no-use-wheel --upgrade

How do I reverse the two commands to get my python back to its original state in OSX? (removing pip as part of it)

Asked By: Setsuna



The first thing you should try is:

sudo pip uninstall pip

On many environments that doesn’t work. So given the lack of info on that problem, I ended up removing pip manually from /usr/local/bin.

Answered By: nacho_dh

In order to completely remove pip, I believe you have to delete its files from all Python versions on your computer. For me, they are here:

cd /Library/Frameworks/Python.framework/Versions/Current/bin/
cd /Library/Frameworks/Python.framework/Versions/3.3/bin/

You may need to remove the files or the directories located at these file-paths (and more, depending on the number of versions of Python you have installed).

Edit: to find all versions of pip on your machine, use:
find / -name pip 2>/dev/null, which starts at its highest level (hence the /) and hides all error messages (that’s what 2>/dev/null does). This is my output:

$ find / -name pip 2>/dev/null
Answered By: aralar

In my case I ran the following command and it worked (not that I was expecting it to):

sudo pip uninstall pip

Which resulted in:

Uninstalling pip-6.1.1:
  <and all the other stuff>

Proceed (y/n)? y
  Successfully uninstalled pip-6.1.1
Answered By: srk

Aditionally to the answer from @srk, you should uninstall package setuptools:

python -m pip uninstall pip setuptools

If you want to uninstall all other packages first, this answer has some hints:

Note: before you use the commands from that answer, please carefully read the comments about side effects and how to avoid uninstalling pip and setuptools too early. E.g. pip freeze | grep -v "^-e" | grep -v "^(setuptools|pip)" | xargs pip uninstall -y

Answered By: t0r0X

Since pip is a package,
pip uninstall pip
Will do it.
EDIT: If that does not work, try sudo -H pip uninstall pip.

Answered By: nasaplays

On macOS Big Sur Version 11.0.1

$ which pip
output: /usr/local/bin/pip
$ cd /usr/local/bin

There I found pip, pip2, pip2.7

$ sudo rm -r pip # for each version to remove

Somehow the installation with easy_install was corrupted.

Answered By: jaminyah

First see the path of the python site-packages files by running this python code

import os 
import inspect 

a path will be printed, take it and add it as a parameter to your pip command

pip install package_name -t "the printed path"

Eg: pip install pandas -t "the printed path"

Answered By: Viraj Rathod
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.