30

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?

2

4 Answers 4

51

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
    
4
  • Are you suggesting to add the two lines in point 1 in bashrc ?
    – anki
    Oct 6, 2019 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 6, 2019 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 apple.stackexchange.com/questions/367313/… For saving me the trouble. One such command(in my file) also brings up which git branch is active.
    – anki
    Oct 6, 2019 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 6, 2019 at 12:39
37

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
0
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 <<<
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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .