Deactivate conda's base environment on startup
When opening a terminal session, conda activates the base environment by default. If you want to prevent this default behaviour, you have three ways:
Trick #1: set
Trick #2:
However, there is a caveat with this trick, as the StackOverflow user DryLabRebel comments, "this means that in every terminal session you
activate a Conda environment, then deactivate a Conda environment,
which you wouldn't notice, but it's not the same as preventing a default
activation." See Trick #3 for a workaround.
Reference: https://stackoverflow.com
As the StackOverflow user DryLabRebel comments, unlike Trick #2, in every terminal session, no conda environment is activated at all with Trick #3.
Reference: https://stackoverflow.com
- Trick #1 : Set the
auto_activate_base
parameter to false - Trick #2 : Add
conda deactivate
in your bash configuration file - Trick #3 : Comment out some part of the conda initialisation code block in your bash configuration file
NOTES:
- I'm working with conda version 4.7.5 and miniconda3 (it should also work with anaconda). These tricks also worked with conda version 4.6.14
- After installing conda 4.7, conda added this block of code in my ~/.bash_profile:
This is the block of code that we will modify in the following tricks
Trick #1: set auto_activate_base
to false
Per conda's instructions, "if you'd prefer that conda's base environment not be activated on startup, set the
auto_activate_base
parameter to false". Thus, enter the following command in a terminal:conda config --set auto_activate_base false
Trick #2: conda deactivate
- This works for conda versions >= 4.4.
- In your .bashrc (or .bash_profile), add
conda deactivate
right after the conda initialization code that was auto-generated, like this:fi unset __conda_setup # <<< conda initialize <<< conda deactivate
Reference: https://stackoverflow.com
Trick #3: Comment out the conda initialization code
In your .bashrc (or .bash_profile), comment out the conda initialisation code block like this:
# >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! # __conda_setup="$('/Users/test/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" # if [ $? -eq 0 ]; then # eval "$__conda_setup" # else if [ -f "/Users/test/miniconda3/etc/profile.d/conda.sh" ]; then . "/Users/test/miniconda3/etc/profile.d/conda.sh" else export PATH="/Users/test/miniconda3/bin:$PATH" fi # fi # unset __conda_setup # <<< conda initialize <<<
As the StackOverflow user DryLabRebel comments, unlike Trick #2, in every terminal session, no conda environment is activated at all with Trick #3.
Reference: https://stackoverflow.com
thanks a lot
ReplyDeleteRespect and that i have a neat provide: Where To Buy Houses For Renovation house remodel contractors
ReplyDeleteThanks and I have a swell supply: Whole House Renovation Cost cost to gut renovate a house
ReplyDelete