Search code examples
pythonanacondacondaapple-m1conda-forge

Using conda-forge as default channel with Anaconda to install packages on Mac Pro M1


I just started a new job, and they gave me a Mac pro to work with. I was reading about the new M1 processor and everything, I found this article particularly useful.

However, I still have one doubt about it. If I didn’t misunderstand, in the article they suggest using either Anaconda (with Rosetta2 translation), OR to install Miniforge, which sets conda-forge as default and only channel, in order to download packages compiled specifically for the M1. I found different tutorials, and they all suggest using Miniforge to install packages on the M1.

My question is…can’t I just use Anaconda, and set conda-forge as the only installation channel, to get M1-compiled packages, like it would do with Miniforge? Or am I misunderstanding something? Thanks!


Solution

  • Update

    I stand corrected. A bit of explanation: In each channel, there exist subdirs for different OS and architectures. When you install conda, then it will automatically look in the correct subdir for all channels that you configure. The difference between a conda that was installed for arm and x64 will be in what subdirs it looks. E.g. for my conda on a linux machine (installed through miniconda) where I added the conda-forge channel manually, the list of channels actually looks like this:

               channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                              https://conda.anaconda.org/conda-forge/noarch
                              https://repo.anaconda.com/pkgs/main/linux-64
                              https://repo.anaconda.com/pkgs/main/noarch
                              https://repo.anaconda.com/pkgs/r/linux-64
                              https://repo.anaconda.com/pkgs/r/noarch
    

    On your MAC, it will look similar for your 64bit installation of anaconda/miniconda. Now to the difference between miniforge and anaconda/miniconda: The first is already preconfigured to use the conda-forge channel, the latter ones can be configured to to the same. So far, no difference. The sole difference will be that you can only install x64 versions of anaconda and miniconda, but miniforge can be installed as an arm64 installation, which will look into different sub-directories of conda-forge, i.e. conda-forge/osx-arm64.

    You can however modify which sub-directory is considered when a conda command is run. I have no experience on how stable that works though. This can be achieved by setting the environment variable CONDA_SUBDIR=osx-arm64 which you can set each time before running a specific command, or you just set it using the conda env config command for your environment. You will have to make sure that all packages in an env will be installed while the CONDA_SUBDIR=osx-arm64 variable is set though.


    Old

    There are currently only 64 bit installers for anaconda. All that come along it will be 64bit. All modules installed will be targeted for 64 bit and conda will download 64bit modules. You cannot install arm modules to a 64 bit conda installation. You will need to decide:

    1. "Convenience" (very subjective) of anaconda, i.e. getting a bunch of pre installed packages targeted for 64 bit
    2. An installation specific for your architecture with possible speed and other advantages