Anaconda is an open-source package manager, an environment manager, a Python/R data science distribution. It has a large collection of open-source packages. It is a popular Python-based data science and machine learning platform. Anaconda aids in the processing of large-scale data, scientific computing, and predictive analysis.
You can use Anaconda Navigator (GUI) or conda (cli) to install, remove or update the Anaconda package. Anaconda makes it simpler for developers using python/R to install all (or most) of the libraries in a single installation.
In this tutorial, we learn how to install Anaconda on Ubuntu 20.04.
- Physical server or virtual machine.
- Minimum CPU: 2 x 64-bit
- Storage: Recommended minimum of 20 GB (Anaconda comes with lots of packages, so consume space)
- Internet access to download the files
Step 1: Install dependencies
Anaconda Navigator is a graphical user interface that allows you to easily manage packages. If you wish to use a GUI after installing Anaconda on your system, install the following packages. Otherwise, you can skip this step.
Install the dependencies packages for Anaconda Navigator:
$ sudo apt install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6
Step 2: Download Anaconda
Next, download the Anaconda installation script file from the official site. At the time of writing this tutorial, the current stable version of Anaconda is 2021.05.
To download Anaconda, type:
$ wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
Step 3: Verify the Installation script’s Integrity
Once the download is done, you can check the script’s data integrity. Run the following command to validate the script’s integrity using the SHA-256 checksum.
$ sha256sum /tmp/Anaconda3-2021.05-Linux-x86_64.sh
You should get a long alphanumeric number printed on the terminal
To verify the script file, head over to the Anaconda script verification page. Be sure to click on the entry that corresponds to the architecture of the script file.
Scroll all the way down to the SHA 256 and ensure that the output generated on the screen matches the SHA 256 value.
Step 4: Install Anaconda
To begin the installation of Anaconda on Ubuntu, invoke the following command:
$ bash /tmp/Anaconda3-2020.02-Linux-x86_64.sh
You will be required to review the license, and to do so, press ‘ENTER’.
Next, type ‘Yes‘ to accept the license terms.
Next, you’ll be required to select the installation location. For simplicity’s sake, go with the default location and press Enter to proceed.
Once the installation is done, you will be prompted to initialize Anaconda by running the
conda init command. This changes the PATH variable to allow Anaconda to run from any directory on your computer. Type yes to proceed.
Once the installation is complete, the output provided will be printed on your terminal.
As directed, you need to close and reopen the terminal or shell to complete the installation. Then source the bashrc file to load the new PATH environment into the current shell as shown:
$ source ~/ .bashrc
The installation is now complete. Let’s now verify that.
Step 5: Verify Anaconda Installation
To confirm Anaconda was successfully installed on Ubuntu 20.04. Run the command:
This prints out all the available command options associated with Anaconda.
To open the navigator GUI page, run the command:
Even though we have downloaded and installed the most current version of Anaconda, there may still be patches and updates available.
To update conda run:
$ conda update --all
If there are any available updates, a list of the packages to be updated will be displayed on the terminal.
Uninstalling Anaconda on Ubuntu
To uninstall Anaconda, you can just remove the installation folder and remove the environment variables set in
rm -rf /usr/local/anaconda
And finally, you can edit the
~/.bashrc file and remove the following entries added for the Anaconda directory from your PATH environment variable.
# added by Miniconda3 installer export PATH="/root/miniconda3/bin:$PATH"
We have successfully installed Anaconda on the Ubuntu 20.04 system. You can now start embarking on your Python and data science projects!