Learn how to install the Anaconda toolkit in Ubuntu 20.04

How to install Anaconda in Ubuntu 20.04

Anaconda (Anaconda Individual Edition) is basically a free and open-source distribution of the programming languages Python and R. The distribution comes with the Python interpreter and various packages related to machine learning and data science. You will need this distribution in your server or desktop if you work with machine learning and related libraries.

In this article, I will explain to you how to easily install Anaconda in your Ubuntu 20.04 server or desktop.

1. Update Local Package Manager

As first step, be sure to update the local package manager using the following instruction:

sudo apt-get update

2. Download Anaconda Installer Script

Switch to the temporary directory of the system with the following command:

cd /tmp

In this directory, you will download the latest available Anaconda Installation Script for Linux (you can obtain it from the official website here). Till the date of writing this article, the latest version is Anaconda3 2021 05, however there may be a new version available. Be sure to check what's the latest available version:

Anaconda Installers

Copy the download link and download it through the terminal using the following command:

wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh

After downloading the installation script, proceed to the next step.

3. Verify Script Integrity (optional)

The verification of the downloaded script is optional. Checksum is used as a security tool to verify the authenticity and integrity of the downloaded script, run the following command providing as argument the filename of the downloaded script:

sha256sum Anaconda3-2021.05-Linux-x86_64.sh

This will generate a hash like the following one:

2751ab3d678ff0277ae80f9e8a74f218cfc70fe9a9cdc7bb1c137d7e47e33d53  Anaconda3-2021.05-Linux-x86_64.sh

You can compare the generated hash with the official hashes in the documentation of Anaconda here. In this case, the hash matches the mentioned version of the script.

4. Install Anaconda

After the verification of the script, you only need to run the script using bash:

bash Anaconda3-2021.05-Linux-x86_64.sh

This will start the setup in the terminal:

Welcome to Anaconda3 2021.05

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

After pressing enter for the first time to confirm the installation, at the bottom after reading the license agreement, type yes to agree to the terms. The installer will prompt you to accept the default location, or install to a different location. Use the default path unless you have a specific need to change it. (You may cancel the installation here if needed.)

Anaconda3 will now be installed into this location:
/home/ourcodeworld/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

The installation will start and it will take a while. Once it finishes it will ask for confirmation about initializing anaconda using conda init.  For changes to take effect, close and re-open your current shell.

5. Testing Anaconda

After installing and launching a new shell, Anaconda will be available through the terminal. Run the following command to test it:

conda info

This command will generate the following output:

active environment : base
    active env location : /home/ourcodeworld/anaconda3
            shell level : 1
       user config file : /home/ourcodeworld/.condarc
 populated config files :
          conda version : 4.10.1
    conda-build version : 3.21.4
         python version : 3.8.8.final.0
       virtual packages : __linux=5.4.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/ourcodeworld/anaconda3  (writable)
      conda av data dir : /home/ourcodeworld/anaconda3/etc/conda
  conda av metadata url : https://repo.anaconda.com/pkgs/main
           channel URLs : 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
          package cache : /home/ourcodeworld/anaconda3/pkgs
                          /home/ourcodeworld/.conda/pkgs
       envs directories : /home/ourcodeworld/anaconda3/envs
                          /home/ourcodeworld/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.8 Linux/5.4.0-89-generic ubuntu/20.04.1 glibc/2.31
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

Happy coding ❤️!


Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Become a more social person

Sponsors