Let’s chat a bit first

If you don’t know what Anaconda is, then you probably don’t need this guide! It’s mostly just for folks who have taken previous data classes.

Why uninstall Anaconda?

Anaconda can be a great tool if you want to hop into complex things like machine learning - it installs common bits of code you might need and gets everything set up Just Right.

In the real world, though, 80% of your problems involve tweaking your computer and uninstalling or reinstalling certain bits of code. Anaconda is like a well-meaning parent that won’t give you the freedom a rebellious teenager needs - it adds an additional layer of complexity that gets in the way when you’re trying to grow.

If we want to get technical, Anaconda used to be awesome back before pip distributed prebuilt binaries. Back then, installing certain packages with pip took ages and ages - now it’s nice and quick!

Another point is that while a lot of people use conda - the Anaconda package manager - far far far more people use pip, the one that comes with Python. When you’re googling for answers you’re going to want to use what’s more common.

Should I be afraid?

No, show no fear! Don’t be afraid!

We aren’t even actually uninstalling Anaconda, we’re just making your computer forget where it lives. If you run into any problems it’s easy to remind your computer and switch back.

Also, our setup will allow you to hop back and forth between Python 2 and Python 3 with ease, so when you’re tempted into the world of 2.7 you’ll be able to pop back into Python 3 just as simply.

How to uninstall Anaconda

Step 1: Open up your plain-text editor

Whether you’re using Atom, Sublime Text, TextWrangler, Visual Studio Code, or whatever, open it. Just make sure you aren’t using Microsoft Word.

Step 2: Bombproof Step 3

In Step 3 we open up a certain file, but first let’s make sure that file exists. Open up Terminal (what’s that?) and run the following command.

touch ~/.bash_profile

touch creates a file if it didn’t exist already. If it does exist, it just ignores it. Do you get a Permission denied error? Try it like this

sudo chown `logname` ~/.bash_profile
touch ~/.bash_profile

The first line changes ownership of the file to you. You use sudo to convince the computer to do things it doesn’t want to do.

When you’re getting Permission denied, it’s because the file belongs to root, who is kind of the king magic all-powerful user of the computer. It’s weird that something in your user directory would be owned by root instead of by you, I’m guessing you installed something in a… weird way at some point.

Step 3: Open up ~/.bash_profile

See how ~/.bash_profile has that dot in the filename? That makes it hidden! You’ll need to read how to edit hidden files to learn how to open it.

Step 4: Changing where your computer looks for things (the PATH)

Your computer uses a setting called the PATH to know where to find programs to run. One of the lines in ~/.bash_profile adds Anaconda’s version of Python to the path - we’re going to make your computer ignore this line so it doesn’t affect anything.

Find the line that looks like the following

export PATH="/Users/soma/anaconda/bin:$PATH

this means, “Make sure you always look for programs in /Users/soma/anaconda/bin.” In order to prevent this from happening, add a # to the beginning of the line.

# export PATH="/Users/soma/anaconda/bin:$PATH

Step 5: Making sure it worked

Now you need to open up a new Terminal window. Any existing terminal window still knows about Anaconda, so you need to start a fresh one.

Once it’s open, run the following line

which python

RIGHT ANSWER: Something like /usr/bin/python, which means the computer successfully forgot about Anaconda.

WRONG ANSWER: Something like /Users/soma/anaconda/bin/python, which means it’s still looking at Anaconda.

If you didn’t get the “right” one, try to edit your ~/.bash_profile again or double-check that you opened up a new Terminal window.

Step 6: Rejoice at freedom from tyranny

At this point champagne is definitely an option.