switch among conda installs

Asked by At

At least in bash + conda v4.6.14, conda init adds the following to ~/.bashrc:

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

...so that the conda activation will occur during log in. This is great IF there is only one (mini/ana)-conda install on the file system.

I have multiple miniconda installs on the same file system, so how do I switch between them if only one install is set in the .bashrc file?

Sourcing an alternative conda setup (ie., source ~/.bashrc_for_other_conda_install) still keeps some of the initial ~/.bashrc conda setup (eg., PATH info). I've been trying to figure out a way to do this with direnv, but I haven't figured it out.

0 Answers