How to deactivate or disable the Anaconda Base environment

avatar
Borislav Hadzhiev

Last updated: Apr 10, 2024
4 min

banner

# Table of Contents

  1. How to deactivate or disable the Anaconda Base environment
  2. Disabling the Anaconda base environment
  3. Enable the base environment but hide the (base) command line prompt
  4. The purpose of the base Anaconda environment

# How to deactivate or disable the Anaconda Base environment

When you open your terminal after installing Anaconda, you will see that that base environment is automatically activated.

conda base environment

If you don't want to enter the base environment when opening your terminal set the auto_activate_base config option to false.

You can issue the following command if you don't want to enter the Anaconda base environment every time you open your terminal.

shell
conda config --set auto_activate_base false

anaconda disable activating base by default

If you open a new terminal session, you'll see that the base environment is not activated automatically.

base environment not automatically activated

If at any point in time, you want to revert the change, set the base environment to be activated automatically by setting auto_activate_base to true.

shell
conda config --set auto_activate_base true

If you run the command, the next time you open your terminal, it will automatically activate the Anaconda base environment.

Note that you can't delete the Anaconda base environment.

base is the default Anaconda environment and cannot be deleted.

# Disabling the Anaconda base environment

If you simply need to disable the Anaconda base environment, use the conda deactivate command.

shell
conda deactivate

disable conda base environment

If you need to activate the base environment, use the conda activate command.

shell
conda activate

activate conda base environment

# Enable the base environment but hide the (base) command line prompt

When the auto_activate_base setting is set to false, opening a new terminal session doesn't automatically start the base Anaconda environment.

shell
conda config --set auto_activate_base false

However, there is also a setting that allows you to start the base environment without modifying your terminal prompt.

shell
conda config --set changeps1 false

disable showing active environment

When the changeps1 setting is set to false, the next time you open your terminal, you won't see the (base) environment message even though the environment is active.

The setting basically disables showing the active Anaconda environment.

If you need to re-enable showing the active environment, set changeps1 to true.

shell
conda config --set changeps1 true

re enable showing active anaconda environment

When the prompt modifier is disabled, you might get confused about which Anaconda environment is currently active.

You can issue the conda info --envs command to check the currently active Anaconda environment.

shell
conda info --envs

conda check currely active environment

The command shows an asterisk * next to the currently active Anaconda environment.

# The purpose of the base Anaconda environment

The base environment is the default Anaconda environment.

As with all other environments, it is used to install packages in isolation.

If you need to get a better understanding of how environments work, open the Anaconda Navigator.

For example, on Linux or macOS, you can issue the following command from your terminal.

shell
anaconda-navigator

On Windows, you can search for Anaconda Navigator and start the application.

Once you open the Anaconda Navigator, click on the Environments tab.

view your anaconda environments

The Anaconda environments are shown right below the Search Environments input field.

You can create a new environment by clicking on the Create button at the bottom.

You can activate an environment by clicking on it. The active environment has a green left border and a run button.

active anaconda environment

To install a package after you've selected the environment:

  1. Select to filter by All or Not installed packages.

  2. Type the name of the package in the search field.

install package in specific environment

  1. Click on the check box next to the package's name.

  2. Click on the Apply button.

The package will only be installed in the currently active virtual environment.

This limits the scope of security vulnerabilities and enables you to install different versions of the same package on the same machine without breaking your dependencies.

If you need to activate your new environment using the command line, issue the conda activate <your-env> command.

shell
conda activate <your-env>

Make sure to replace the placeholder with the actual name of your virtual environment.

activate your new virtual environment

As previously noted you can use one of the following commands to list the available virtual environments.

shell
conda info --envs # Or conda env list

The currently active environment will have an asterisk * next to its path.

Make sure you don't try to delete the base Anaconda environment as this is not allowed.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.