Skip to content

How to Stop Anaconda Activating the Base Environment Automatically

Learn how to disable automatic activation of the Conda base environment and customize terminal behavior with conda config commands.

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.

(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.

conda config --set auto_activate_base false

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.

conda config --set auto_activate_base true

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):
    (base) user@hostname:~$ conda deactivate
    
    user@hostname:~$
  • To manually enter (activate) the base environment:
    user@hostname:~$ conda activate base
    
    (base) user@hostname:~$

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.

conda config --set changeps1 false


conda config --set changeps1 true

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.

conda info --envs

base                  *  /home/user/anaconda3
my_env                   /home/user/anaconda3/envs/my_env

conda env list
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.
Navigation