Skip to main content

How to Stop Anaconda Activating the Base Environment Automatically

When you install Anaconda or Miniconda, you might notice that your terminal prompt automatically shows (base) at the beginning of the line upon opening a new session. This indicates that the default base Conda environment has been activated. While useful initially, you might prefer not to have it activate automatically every time.

This guide shows you how to disable this behavior and manage the base environment prompt.

Understanding the Default Behavior

By default, the Anaconda installer configures your shell to automatically activate the base environment whenever you start a new terminal session. This ensures that Conda commands and packages installed in base are immediately available. The (base) prefix in your prompt is a visual indicator of this active environment.

# Typical prompt after fresh Anaconda install
(base) user@hostname:~$

Preventing Automatic Activation of base

If you prefer not to enter the base environment automatically every time you open a terminal, you can change Conda's configuration. Use the conda config command to set the auto_activate_base option to false.

# Command to disable automatic activation
conda config --set auto_activate_base false

# Effect: The next time you open a new terminal, 'base' won't be active by default.
# Your prompt will look like your standard system prompt.
# Example:
# user@hostname:~$

You need to open a new terminal session after running this command to see the effect. Your existing sessions will remain unchanged until closed or manually deactivated.

Re-enabling Automatic Activation of base

If you later decide you want the base environment to activate automatically again, simply set the auto_activate_base configuration back to true.

# Command to re-enable automatic activation
conda config --set auto_activate_base true

# Effect: New terminal sessions will once again activate 'base' automatically.
# Example Prompt in new terminal:
# (base) user@hostname:~$

Manually Exiting and Entering the base Environment

Disabling automatic activation doesn't prevent you from using the base environment. You can manually activate and deactivate it within any terminal session.

  • To exit (deactivate) the currently active environment (like base):
    # If (base) is active:
    (base) user@hostname:~$ conda deactivate

    # Prompt returns to normal:
    user@hostname:~$
  • To manually enter (activate) the base environment:
    # If 'base' is not active:
    user@hostname:~$ conda activate base

    # Prompt now shows (base):
    (base) user@hostname:~$
    note

    On some older Conda versions or configurations, just conda activate might activate base if no environment name is given, but explicitly using conda activate base is clearer.

Hiding the (base) Prompt While Keeping it Active

Perhaps you want the base environment's packages available by default (auto_activate_base true), but you dislike the (base) prefix cluttering your prompt. You can disable the prompt modification using the changeps1 setting.

# Disable the prompt modification (but base might still be active)
conda config --set changeps1 false

# Effect: If auto_activate_base is true, new terminals will still activate 'base',
# but the prompt will NOT show (base).
# Example Prompt in new terminal (assuming auto_activate_base is true):
# user@hostname:~$ <-- Looks normal, but 'base' environment IS active!

# To re-enable showing the active environment in the prompt:
conda config --set changeps1 true
warning

Disabling the prompt modifier (changeps1 false) can be confusing, as you won't have a visual cue about which Conda environment is active.

Checking the Active Environment (When Prompt is Hidden)

If you've disabled the prompt modification (changeps1 false), you need a way to check which environment is actually active. Use the conda info --envs or conda env list command. The active environment will have an asterisk (*) next to its path.

# Command to list environments and see the active one
conda info --envs

# Example Output (if 'base' is active):
# conda environments:
#
base * /home/user/anaconda3
my_env /home/user/anaconda3/envs/my_env

# Or using 'conda env list':
conda env list
# Example Output:
# conda environments:
#
base * /home/user/anaconda3
my_env /home/user/anaconda3/envs/my_env

The Purpose of the base Environment

The base environment is created during Anaconda/Miniconda installation. It serves several purposes:

  • Contains Conda: It houses the conda package manager itself and its core dependencies.
  • Default Environment: It's the default location for packages if you install something without specifying or activating another environment first (though creating separate environments for projects is highly recommended).
  • Isolation: Like all Conda environments, it isolates its packages from other environments and your system's Python installation.

While you can install packages directly into base, the best practice is generally to create separate environments for your different projects (conda create --name myprojectenv python=3.9) and activate those (conda activate myprojectenv) before installing project-specific packages. This prevents dependency conflicts between projects. You can not, however, delete the base environment itself.

Conclusion

You have control over whether Anaconda's base environment activates automatically when you start a terminal.

  • Use conda config --set auto_activate_base false to disable automatic activation.
  • Use conda config --set auto_activate_base true to re-enable it.
  • Use conda deactivate and conda activate base to manually exit and enter the environment in your current session.
  • Use conda config --set changeps1 false to hide the (base) prompt prefix, but be aware this can make it harder to know which environment is active without using conda info --envs. Understanding these settings allows you to configure your Conda workflow to your preference.