In this guide, we will be going through the process of installing Anaconda on Windows and Linux.
While I have used Windows 10 and Ubuntu 22.04, the process should be the same regardless of which Windows or Linux operating system you use.
What is Anaconda?
Anaconda is a very popular open-source Python and R distribution platform for scientific computing. It is a single application that comes with many useful tools out of the box. These include the Python and R language interpreters, IDEs such as Spyder and Jupyter Notebooks, and many popular Python packages you will likely need, such as Numpy, Matplotlib, and Tensorflow. It is basically the Swiss army knife of data science and scientific computing.
Why is Anaconda so popular?
- One of the advantages of Anaconda is that it simplifies the task of package and environment management. So rather than have your Python packages in the global space, you can choose to have them in virtual environments where the dependencies of one project do not affect the dependencies of another.
- As with much of the software we developers like to use, it is free and open source.
- It is easy to use. You can use Navigator, the GUI tool, or Conda, the command-line tool.
How to install Anaconda on Linux (Ubuntu)
To install Anaconda on Linux, we will download the installation script from Anaconda.org and execute it from the terminal. In this guide, I’ll use the Bash terminal, which is standard on most Linux distributions.
#1. Move to the Downloads folder
I would like to download the installation script into my Downloads folder. Therefore first, I will move to the Downloads folder using this command.
$ cd ~/Downloads
You can choose whichever directory you prefer. Popular options include the
/tmp directory because files in that directory are automatically deleted when the computer restarts.
#2. Download the Anaconda installation script
Download the installation script using the following curl command:
$ curl https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh -o Anaconda.sh
Here I am downloading the 2022.05 version that works on x86_64 processors. Make sure to pick one that works on your machine. You can do this by heading over to the downloads page of Anaconda.org and copying the link address of the download button.
#3. Run the script
Run the installation script using bash using the following command. Use the actual file path to Anaconda instead of path/to/Anaconda.
$ bash ./Anaconda.sh
Here ./Anaconda.sh is where I saved my installation script. If you used a different file path or name during the download, be sure to use that instead.
The program should start running, and you should see the following text in the terminal:
Welcome to Anaconda3 2022.05 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue
#4. Accept the license agreement
Press Enter repeatedly to go through the license. After you have finished going through the license, you should see a prompt asking if you accept it or not. If you accept, type ‘yes’ and press ENTER.
Do you accept the license terms? [yes|no] [no] >>> Please answer 'yes' or 'no':
#5. Choose the installation directory
After accepting the license, you should see a prompt asking where you want to install Anaconda. The file location you choose will be where the Anaconda files are stored. You can select the default location by pressing ENTER. Alternatively, you can specify a custom location by typing it out and pressing ENTER.
Anaconda3 will now be installed into this location: /home/anesu/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/anesu/anaconda3] >>>
#6. Initialize Anaconda3
After installation is complete, you will get a prompt to initialize Anaconda3 by running
conda init. Just type yes and enter.
Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no]
#7. Add Anaconda to path variables
After completing the installation process, you need to add Anaconda to the terminal path variable so you can call it from anywhere you are.
To add it, we need first to open the
.bashrc file stored in the user’s home directory. You can open it using the nano text editor using the command below:
After the file opens, paste the following line of code at the end of the file. Remember to use Ctrl + Shift + V to paste when using Nano. Use the absolute file path to the Anaconda folder in place of
<path to anaconda folder>. This is the folder where you chose to have Anaconda installed. Make sure to add
/bin after the absolute path to the Anaconda folder.
export PATH='$PATH:<path to anaconda folder>/bin'
#8. Verify installation.
After installation is complete, close your terminal and open it again. When you re-open the terminal, it should say base in parentheses before the normal terminal prompt text. On my computer, it says this:
What base in parentheses means is that you are currently in the base environment.
To launch Anaconda Navigator (the GUI tool), use the ‘anaconda-navigator’ command. To use Conda (the CLI tool), use the ‘conda’ command.
That’s it! 👩💻
If you see the screen above, then you have successfully installed Anaconda. From here, you can launch applications, manage environments and participate in the community. Hopefully, there are no errors at this point. But if there are, do check out the Anaconda Community.