Anaconda: disable prompt change

14,430

Solution 1

If you are like me, you like the non-default environment to show up if you have activated it, but don't want to clutter up your prompt in other cases - (e.g. you happen to use bash for reasons having nothing to do with python)

Place the following excerpt in your ~/.bash_profile right after the section managed by conda:

# ahj - remove the default Python environment artifact "(base)" from prompt
PS1=$(echo "$PS1" | perl -pe 's/^\(base\)\s*//' )

Solution 2

Run this on the terminal:

$ conda config --set changeps1 False

http://conda.pydata.org/docs/config.html#change-command-prompt-changeps1

Solution 3

Add:

changeps1: False

to your .condarc file.

http://conda.pydata.org/docs/config.html#change-command-prompt-changeps1

Solution 4

I've had a slightly different, but related problem: how to avoid the base env to be activated by default for every terminal window. Solution:

conda config --set auto_activate_base False

Note: this only works if you have run conda init first.

Share:
14,430

Related videos on Youtube

DevShark
Author by

DevShark

Favorite languages: python, C++, objective-c, English (in that order) Activities: Father, Husband, Developer, Entrepreneur (the order depending on the most pressing need of the day)

Updated on July 04, 2022

Comments

  • DevShark
    DevShark almost 2 years

    When using anaconda (install for python), when I switch to the virtual env with this:

    source activate my_env
    

    It changes my prompt and adds (my_env) at the start of my PS1.

    I've tried adding export VIRTUAL_ENV_DISABLE_PROMPT=1 to my bashrc, but it did not help.

    Any idea?

    • Adam Chalcraft
      Adam Chalcraft over 3 years
      This is deeply worrying. If anaconda thinks it has the right to edit .bash_profile in a way which changes the prompt, what else does it (mistakenly) think it has the right to do? Turns out, it also adds to the beginning of PATH so that, for example, curl is redefined. Ouch! I’m treating this as malware.
  • Homero Esmeraldo
    Homero Esmeraldo about 5 years
    Any idea on how to do that just for the base environment? (stackoverflow.com/a/54725966/1273751)
  • Bram
    Bram over 4 years
    ONce you have done this, how do you get back a terminal with (base) ?
  • saza
    saza over 4 years
    Hey @Bram, that's simple, just run conda activate, it will activate the base environment! Cheers
  • Kyle Barron
    Kyle Barron almost 4 years
  • Ian Tait
    Ian Tait over 2 years
    Is there any way to make this same change but for PS2 env variable? conda config --set changeps2 False did not work :(