Skip to content

Uninstalling or deactivating Anaconda

Anaconda is a way of installing Python that includes a lot of extras. It's a convenient way to install Python, buuuuut it can cause problems if you already have Python installed or want your installation set up a certain way. It also has a tendency to magically upgrade bits and pieces of your system, which can cause plenty of problems.

I don't like Anaconda! So if you have it installed, this is how to uninstall it.

Do I have Anaconda installed?

The easiest way to know whether you have Anaconda installed is to just look at the command prompt. If you see (base) in front of your prompt, you have Anaconda installed.

I have Anaconda installed

In the image above, I have (base) in front of my prompt, which means I have Anaconda installed.

You might also see (py36), (py37), (tensorflow) or (tensorflow-gpu). All of these also mean you have Anaconda installed.

Managing your Pythons

Anaconda is (potentially) problematic because it installs its own version of both Python and pip, and it makes it hard to get to the "real" Python and pip that you want to use. Let's see how to fix that up.

Why can't we find our Pythons when Anaconda is installed? Let's talk about how Pythons are organized on our computer!

I personally like to use pyenv to manage all of the versions of Python on my computer, and it's what I recommend for setup. If we want to see all of the places Python is found on our computer, we can run which -a python:

Running which -a python without Anaconda

We can see here I two locations where Python is installed:

/Users/soma/.pyenv/shims/python
/usr/local/bin/python

When we type python on the command line, the first one in the list is always the one that gets run. In this case the pyenv Python is in first place, so it's the one that gets run!

If we have Anaconda installed, we'll see a third location:

Running which -a python without Anaconda

/Users/soma/opt/anaconda3/bin/python
/Users/soma/.pyenv/shims/python
/usr/local/bin/python

Since it's at the top, it means every single time we run python it will run the Anaconda version of Python. This is is a problem for us because we want to use the pyenv Python instead.

I could talk about the PATH or pyenv versions or all sorts of other things here, but... let's just stick what what I've said so far and skip ahead to how to remove Anaconda.

Deactivating Anaconda

If you want to use Anaconda sometimes, one option is to use conda deactivate. This tells Anaconda to stop messing with your environment and let you use any of the other Pythons on your machine.

Deactivating Anaconda

In the image above, I've run conda deactivate and now I'm back to using the pyenv Python.

Permanently deactivating Anaconda

When you start up your command line, it runs a little startup file that sets up this-and-that (including Anaconda!). If you want to get rid of Anaconda entirely, we can just remove it from the startup file.

If you're on OS X, the startup file is probably ~/.zshrc. If you've installed Visual Studio Code you can run open ~/.zshrc to open it in VS Code.

It'll probably look something like this below:

zschrc with Anaconda

You'll want to comment out everything between >>>> conda initialize <<<< and >>> conda initialize <<<. This will stop Anaconda from running when you start up your command line.

zschrc with Anaconda

Be sure to leave everything else alone, though! In our case we have some other setup pieces – languages, pyenv, blah blah blah – and we don't want to mess them up by removing them.

Methods that don't work

Kicking around on StackOverflow, I found a few options for deactivating Anaconda that did not work. I'm including them here so you don't waste your time trying them.

Here's one:

# Does not deactivate Anaconda
conda init --dry-run --no-user zsh

Here's another one:

# Does not deactivate Anaconda
conda config --set auto_activate_base false