python-2.7minicondaanaconda3

Switch between anaconda and miniconda (miniforge)


I have installed conda using miniforge. Since my mac has a m1 chip, i had to install conda using Miniforge3-MacOSX-arm64.sh, inorder to get tensorflow working. unfortunately this version (minforge/minconda arm64) doesn't have python2 for some reason. As I require python2 for another project (doesnot require tensorflow) I have decided to install anaconda3.

But now I am unaware how to switch between the two conda versions (anaconda3 and miniconda/miniforge3).

For example when I enter activate conda in the terminal, it activates the base environment of the miniforge version. How do I activate base environment of the anaconda version. So that I can create python2 environment there (anaconda3).


Solution

  • According to this post, one solution is to change the content of your .zshrc file, save your changes, close and reopen your terminal. I tested on a MacBook Pro M1 where Miniforge3 and Anaconda3 are currently installed and it works. In the following, just replace --PATH-- with the path of the requested environment management system. For example, I replace --PATH-- with opt/anaconda3 for Anaconda3 and miniforge3 for .. Miniforge3.

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