34

I created some new aliases in my .bashrc file and did

source ~/.bashrc

Now, everytime I open my terminal it always comes with the (base)

How do I remove that?

anki
  • 11,753

4 Answers4

53

That's the "base" environment from Anaconda or Miniconda. It means the Python environment from conda is enabled by default.

There're two solutions.

  1. Just disable the base environment, make sure your conda >= 4.6. Whenever you wanna use Python, enable an environment from conda manually with following command,

    # run this in an interactive shell
    # enable environment called "base", the default env from conda
    conda activate base
    # deactivate an environment
    conda deactivate
    
  2. Enable the base environment, which is the default behavior of conda, but don't modify your prompt. Run the following command in an interactive shell once.

    conda config --set changeps1 false
    
Simba
  • 1,443
  • Are you suggesting to add the two lines in point 1 in bashrc ? – anki Oct 06 '19 at 12:07
  • @ankii Sorry, I didn't make it clear. The solution No.1 in the hyperlink should be set in .bashrc. The commands activate/deactivate an environment should be run in an interactive shell. – Simba Oct 06 '19 at 12:33
  • But every time one opens terminal, it would be annoying to enter these commands? I've added some lines in my bashrc profile as per this answer https://apple.stackexchange.com/questions/367313/including-virtual-environment-in-bash-prompt For saving me the trouble. One such command(in my file) also brings up which git branch is active. – anki Oct 06 '19 at 12:34
  • @ankii The solution one is to DISABLE activating the "base" environment, which means make the Python executable from "base" unavailable. – Simba Oct 06 '19 at 12:39
39

If you'd prefer that conda's base environment not be activated on startup, you can always set the auto_activate_base parameter to false:

conda config --set auto_activate_base false
Marcel
  • 491
3

The following code in the .bashrc file should initialize an anaconda environment. Just remove them.

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/proshore/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2$
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/proshore/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/proshore/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/proshore/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
nohillside
  • 100,768
bikram
  • 161
1

This happens due to the installation o Anaconda or Miniconda. Depending on your mac version, you can just add one more line at the end of "~/.zshrc" or "~/.bashrc" with vim or any of your fav editors.

conda deactivate

Save the file, and now whenever you open the terminal again you won't see (base).