Starting your Data Science Experience: Installing Anaconda3
Now, I know what you might be thinking: installing Anaconda3 should be a very simple process. Right? However, that is not always the case. Sometimes you find yourself with an error that just doesn’t make sense. Personally, when I started learning about Data Science, I went through this process. It can be very important to have this tool because then you get access to wonderful programs such as the Jupyter Notebook. So, I went through the normal process. I went to the site, and downloaded the installer. Cue a few minutes of reading the agreements and waiting for the Anaconda to install. It finishes installing and even gives me a wonderful thank you for installing their program. I go to my Terminal to make sure that the system is working by typing: conda info. However instead of a nice readout of information, I instead get a dreaded error message:
zsh: command not found: conda
It is a terrible thing when everything seems to be working until it doesn’t. You haven’t even started to learn about data science yet and you already have reached your first error. I knew that Anaconda3 had installed correctly. They gave me the nice Thank You message. It should work right? WRONG!! Now thankfully, while it can take a good deal of sleuthing on google search, the answer to this problem is quite simple.
The first thing to note is that if you are using a newer version of macOS like Catalina, Mac has decided to make zsh to be our default shell, instead of bash. This is important because Anaconda3 has been initialized to bash and not zsh. This is why we receive the dreaded command not found message. So, let’s get into how we can install Anaconda3 and be able use all those fun programs.
For the full installation guide you can go to the following site: https://docs.anaconda.com/anaconda/install/
The first step, of course, is to head to the site to install Anaconda3. You can find it here: https://www.anaconda.com/products/individual
Now at the bottom of the page, you will find your possible Anaconda Installers.
If you are only going to use the graphical user interface with Anaconda-Navigator, you can use the Graphical Installer. If you are going to be using the command line often, I would suggest using the Command Line Installer. I tried the Graphical Installer before, but I found that for ease of use for our fix, the Command Line was the way to go.
Once your browser has downloaded the installer, your second step will be to open a new window in your Terminal. If you are having trouble finding your terminal, one can find it in their Launchpad under Other.
For your third step, you will need to know what version of python your computer is running. You can do this easily by typing python into your terminal.
For Python 3.7 you will want to type in your terminal:
For Python 2.7:
It is important to note that instead of Downloads you use the path to your Command Line Installer and afterwards use the actual name of the file you downloaded.
Just like in the graphical installer, it will ask you to read through the license agreement. Unfortunately, this means pressing the enter button many times to get through the entire agreement. Once you reach the end you will have to enter yes to agree.
The installer will prompt you with the location of the install. You can change it, but I would suggest using the default location. Pay attention to the path being used. It will be important in the future to deal with the error. Once you press enter, it will show the default path and begin the installation.
Like any installer, this will take a few minutes.
Now, after the installer finishes, it should prompt you with:
Do you wish the installer to initialize Anaconda3 by running conda init?
If you get this, I would definitely suggest confirming yes. This should allow you to use the conda command in your terminal. But sometimes, like it did with my installation, the computer automatically entered No.
The installer will then give you that very nice thank you. How polite! You exit out of your terminal and reopen it. You should be able to use the conda command. If you were unable to initialize Anaconda3 like I did, you can do it yourself:
source <path to conda>/bin/activate
You replace <path to conda> with your own path. If you are wondering, it is the default location that the installer presented or the path you changed it to. See! Told you that it was important to remember!
After, you enter: conda init zsh
Hurray, restart your terminal and you should be able to enter a conda command such as conda info to confirm that it was correctly installed.
Now you are able to begin your journey into data science being able to use important tools such as Jupyter notebook.