How to Install Anaconda on Ubuntu 20.04

how to install anaconda on ubuntu 20.04

Anaconda is a free, open-source, and one of the most popular distributions of Python and R Programming languages. Generally, it is used for scientific computing, predictive analysis, machine learning, and large-scale data processing. It is cross-platform distribution and it can be installed on Linux, Windows, and Mac OS.

In this tutorial, we will show you how to install and use Anaconda on an Ubuntu 20.04 VPS.

Prerequisites

  • An Ubuntu 20.04 VPS (we’ll be using our SSD 2 VPS plan)
  • Access to the root user account (or access to an admin account with root privileges)

Step 1: Log in to the Server & Update the Server OS Packages

First, log in to your Ubuntu 20.04 server via SSH as the root user:

ssh root@IP_Address -p Port_number

You will need to replace ‘IP_Address’ and ‘Port_number’ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.

Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:

apt-get update -y
apt-get upgrade -y

Step 2: Download Anaconda

First, visit the Anaconda download page and download the latest version of the Anaconda installation script with the following command:

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

Once the download has finished, you can proceed and install Anaconda.

Step 3: Install Anaconda

Now, run the Anaconda installation script to start the installation:

bash Anaconda3-2020.11-Linux-x86_64.sh

You should see the following output:

Welcome to Anaconda3 2020.11

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

Press Enter to start the installation. You will be asked to accept the license and choose the installation directory as shown below:

Do you accept the license terms? [yes|no] yes

Anaconda3 will now be installed into this location:
/root/anaconda3

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

[/root/anaconda3] >>> 

Press Enter to confirm the location and continue the installation process. Once the installation is completed, you should get the following output:

Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes

Type yes and press Enter to initialize the Anaconda. You should get the following output:

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Anaconda3!

===========================================================================

Working with Python and Jupyter notebooks is a breeze with PyCharm Pro,
designed to be used with Anaconda. Download now and have the best data
tools at your fingertips.

PyCharm Pro for Anaconda is available at: https://www.anaconda.com/pycharm

Next, activate the Anaconda environment variable with the following command:

source ~/.bashrc

You can now verify the installation using the following command:

conda info

You should get the following output:

    active env location : /root/anaconda3
            shell level : 1
       user config file : /root/.condarc
 populated config files : 
          conda version : 4.9.2
    conda-build version : 3.20.5
         python version : 3.8.5.final.0
       virtual packages : __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /root/anaconda3  (writable)
           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 : /root/anaconda3/pkgs
                          /root/.conda/pkgs
       envs directories : /root/anaconda3/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.5 Linux/5.4.0-29-generic ubuntu/20.04 glibc/2.31
                UID:GID : 0:0
             netrc file : None
           offline mode : False

Step 4: Update Anaconda

It is recommended to update Anaconda regularly. To update the Anaconda, first update the conda with the following command:

conda update conda

Next, update Anaconda with the following command:

conda update anaconda

Step 5: Create Anaconda Environment

You can create a Python 3 environment for Anaconda using the following command:

conda create --name my_env

Next, activate the environment with the following command:

conda activate my_env

You should get the following output:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
(my_env) root@ubuntu2004:~# 


Congratulations! you have successfully installed Anaconda on Ubuntu 20.04.

Step 5: Uninstall Anaconda

In order to uninstall Anaconda from your system, you will need to install the Anaconda removal utility to your system.

First, install the anaconda-clean utility with the following command:

conda install anaconda-clean

Once the installation is completed, remove Anaconda with the following command:

anaconda-clean --yes

You should get the following output:

Backup directory: /root/.anaconda_backup/2021-01-07T084617
install anaconda on ubuntu 20.04

Of course, you don’t have to do any of this if you use our Managed Python VPS, in which case you can simply ask our expert Linux admins to set up this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, please share it with your friends on social networks or simply leave a reply below. Thanks.

Leave a Comment