Setting up Anaconda Navigator, Spyder, Jupyter, python environments on MacBook with M1 chip for using with Terminal
** Updated as of 11.04.2021 **
With Apple moving away from Intel and releasing the new MacBooks with the ARM based M1 chip, a lot of us are still trying to figure out how many things work. This is a short writeup on how I got the Anaconda Navigator, and along with it, Spyder, Jupyter etc. setup and working. The download and installing is pretty straight-forward. However, if you are like me and is comfortable with using the conda from the terminal, this tutorial is just the right thing for you.
If you are reading this, I assume you already know what conda is. While mini-conda is compatible with the ARM architecture (which I did not yet try to install it on my mac), the full fledged Anaconda Navigator is only available for the x86 architecture. However, the Rosetta 2 translator from Apple allows you to easily run x86 apps on the M1 chip. It means, the x86 compiled Anaconda Navigator can be run on the new MacBooks with M1 chips.
There are many possibilities to setup Anaconda and get it running. The following writeup is one of the easiest methods which I followed to get it running on my MacBook Pro. It should work even if you have a MacBook Air.
Step 1: Download and install Anaconda Navigator
Go to https://www.anaconda.com/products/individual#macos and download the installation package for the MacOS (I prefer the graphical installer as it’s quiet simple to use). Install the navigator by double clicking on the dowloaded file (pretty straight forward process).
If you are happy with using the Anaconda-Navigator app, this is all you need. You can go ahead with creating new environments, installing Spyder, Jupyter Notebook/Lab etc. as usual and launching them from the app.
However, if you are a power user, and need the whole Terminal experience, then follow on with the next steps.
Step 2: Getting the whole Terminal experience [Updated on 11.04.2021]
As of 11.04.2021, the above step 1 should be sufficient to get conda running once you open the terminal. Thanks to Claire Carter, who wrote in the comment to this post, the Anaconda installation will add the initialization script to .zshrc or .bashrc depending on the shell you are using, which should get things running out of the box.
However, if you are one of those people for whom it doesn’t work, then you can follow the below steps..
After installing the Anaconda Navigator, when you open the terminal and type “conda” or “anaconda-navigator” you will see that it may not work and if you receive the following error saying that the command is not found, follow the step below.
To fix this, I first opened the Anaconda-Navigator app and opened a Terminal from it for the base environment. I saw that the you need to call the ‘/opt/anaconda3/bin/activate’ and then the environment to activate conda and use it from the command line.
To start using conda directly every time the Terminal app is opened:
- Make sure which shell you are using; either zsh or bash:
echo $SHELL
- Copy the below line to .zshrc if you are using zsh or to .bashrc if you are using bash shell.
Note: Create the .zshrc or .bashrc in your home directory if you cannot find them.
. /opt/anaconda3/bin/activate && conda activate /opt/anaconda3;
- Close the Terminal app and reopen it.
That’s it! Now if you open the Terminal, you should be able to use conda directly without any hassel. You can run all the conda commands and install python libraries, manage your environments etc. just like on an Intel Mac or your Linux machine!
When you open the Terminal, you will recognize the “(base)” prefix before the username ;)
Cheers!