How do I prevent Conda from activating the base environment by default?

DryLabRebel
:

I recently installed anaconda2 on my Mac. By default Conda is configured to activate the base environment when I open a fresh terminal session.

I want access to the Conda commands (i.e. I want the path to Conda added to my $PATH which Conda does when initialised so that's fine).

But I don't ordinarily program in python, and I don't want Conda to activate an environment by default.

When first executing conda init from the prompt, Conda adds the following to my .bash_profile:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/geoff/anaconda2/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
if [ -f "/Users/geoff/anaconda2/etc/profile.d/conda.sh" ]; then
    . "/Users/geoff/anaconda2/etc/profile.d/conda.sh"
else
    export PATH="/Users/geoff/anaconda2/bin:$PATH"
fi
# fi
unset __conda_setup
# <<< conda initialize <<<

If I comment out the whole block, then I can't activate any Conda environments.

I tried to comment out the whole block except for

export PATH="/Users/geoff/anaconda2/bin:$PATH"

But then when I started a new session and tried to activate an environment, I got this error message:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

This question (and others like it) are helpful, but doesn't ultimately answer my question and is more suited for linux users.

For clarification, I'm not asking to remove the (base) from my $PS1 I'm asking for Conda not to activate base when I open a terminal session.

jieong
:

I have conda 4.6 with a similar block of code that was added by conda. In my case, there's a conda configuration setting to disable the automatic base activation:

conda config --set auto_activate_base false

The first time you run it, it'll create a ./condarc in your home directory with that setting to override the default.

This wouldn't de-clutter your .bash_profile but it's a cleaner solution without manual editing that section that conda manages.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

change default environment from (base) to (env) in conda/anaconda in Ubuntu

From Dev

How to set specific environment variables when activating conda environment?

From Dev

How do I prevent Excel from locking files by default?

From Dev

Activating conda environment over SSH

From Dev

How do I keep an error handler from activating multiple times?

From Dev

How to update from conda 4.3 installed in base environment?

From Dev

How do I clone a conda environment from one python release to another?

From Dev

How do I use a conda environment with mod_wsgi?

From Dev

Conda breaks when activating environment -- CommandNotFoundError: No command 'conda conda'

From Dev

Activating conda environment with its full path

From Dev

activating conda environment in within a shell script

From Dev

How do I prevent ASP.Net from sending a default charset?

From Dev

How do I prevent it from newlining in html?

From Dev

How do I prevent from timedout

From Dev

How do I install libsvm in a conda environment so that I can import svm in anaconda?

From Java

How can I rename a conda environment?

From Dev

How can I rename a conda environment?

From Dev

How do I set the default desktop environment on 18.04 (Bionic)?

From Dev

How do I set the default desktop environment on 18.04 (Bionic)?

From Java

How do I keep track of pip-installed packages in an Anaconda (Conda) environment?

From Dev

How do I pip install packages in a conda environment.yml file?

From Dev

How do I find the name of the conda environment in which my code is running?

From Dev

How do I set optional arguments in the conda environment.yml file?

From Dev

How Do I Prevent Users From Modifying Resources They Do Not Own?

From Dev

How do I prevent sed -i from destroying symlinks?

From Dev

How do I prevent hibernate from dropping times from datetimes?

From Dev

How do I prevent hibernate from dropping times from datetimes?

From Dev

How do I prevent initramfs from resuming from a zram device?

From Dev

How do I prevent a subdirectory from being matched in .gitignore?

Related Related

  1. 1

    change default environment from (base) to (env) in conda/anaconda in Ubuntu

  2. 2

    How to set specific environment variables when activating conda environment?

  3. 3

    How do I prevent Excel from locking files by default?

  4. 4

    Activating conda environment over SSH

  5. 5

    How do I keep an error handler from activating multiple times?

  6. 6

    How to update from conda 4.3 installed in base environment?

  7. 7

    How do I clone a conda environment from one python release to another?

  8. 8

    How do I use a conda environment with mod_wsgi?

  9. 9

    Conda breaks when activating environment -- CommandNotFoundError: No command 'conda conda'

  10. 10

    Activating conda environment with its full path

  11. 11

    activating conda environment in within a shell script

  12. 12

    How do I prevent ASP.Net from sending a default charset?

  13. 13

    How do I prevent it from newlining in html?

  14. 14

    How do I prevent from timedout

  15. 15

    How do I install libsvm in a conda environment so that I can import svm in anaconda?

  16. 16

    How can I rename a conda environment?

  17. 17

    How can I rename a conda environment?

  18. 18

    How do I set the default desktop environment on 18.04 (Bionic)?

  19. 19

    How do I set the default desktop environment on 18.04 (Bionic)?

  20. 20

    How do I keep track of pip-installed packages in an Anaconda (Conda) environment?

  21. 21

    How do I pip install packages in a conda environment.yml file?

  22. 22

    How do I find the name of the conda environment in which my code is running?

  23. 23

    How do I set optional arguments in the conda environment.yml file?

  24. 24

    How Do I Prevent Users From Modifying Resources They Do Not Own?

  25. 25

    How do I prevent sed -i from destroying symlinks?

  26. 26

    How do I prevent hibernate from dropping times from datetimes?

  27. 27

    How do I prevent hibernate from dropping times from datetimes?

  28. 28

    How do I prevent initramfs from resuming from a zram device?

  29. 29

    How do I prevent a subdirectory from being matched in .gitignore?

HotTag

Archive