Ubuntu

How to Install Anaconda on Ubuntu 20.04

How to Install Anaconda on Ubuntu 20.04

What is Anaconda?

In simple terms, Anaconda is an open-source package and environment manager that houses thousands of predictive analysis, machine learning, and data science packages. Its purpose is to provide scientific libraries and dependencies for Python programmers. Anaconda is frequently used for the development of machine learning and artificial intelligence applications.

Anaconda makes package distribution and administration easier. It comes with various tools such as conda and Jupyter Notebook that provide you with a smooth and fast package and environment development. Anaconda also supports the creation of a basic, controllable environment, making any project deployment straightforward.

In this article, you will learn how to install, use, and remove Anaconda from your Ubuntu operating system.

Prerequisites

  • Ubuntu 20.04 or any other Linux-based distribution
  • Terminal access
  • A user account with root or sudo privileges.
  • Internet access

Note: Although the commands used in this tutorial are specifically for the Ubuntu system, all the methods are also valid for any other Linux-based system.

Install Dependency Packages

To use Anaconda Navigator, you need to install the following packages. Anaconda Navigator is a QT-based graphical interface that is highly convenient on the desktop.

sudo apt install libgl1-mesa-glx libegl1-mesa libxrandr2 libxss1 libxrandr2 libxcursor1 libasound2 libxcomposite1 libxi6 libxtst6

Download the Anaconda Installation File

Next, download the installation file for Anaconda using the following wget command.

wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh

It is recommended to take and compare the SHA256 hash of the downloaded file with the official file HASH to prove that your file is authentic.

Use the following SHA256sum command to get the hash of the downloaded file.

sha256sum /tmp/Anaconda3-2021.11-Linux-x86_64.sh

Install Anaconda

Run the downloaded shell script and install Anaconda using the following bash command.

bash /tmp/Anaconda3-2021.11-Linux-x86_64.sh

During installation, you will be prompted to accept the licence terms. Type yes to proceed.

Next, select the location of the installation and hit Enter.

Once installation is finished, Initialise the anaconda using the conda init by typing yes and proceed. Conda is a command-line package manager for Anaconda. Conda inti will not only initialise the anaconda, but it will also add itself to the system variable PATH.

Run the following command to fetch your bashrc file.

source ~/.bashrc

Type conda or conda info in your terminal to verify anaconda installation.

Open Conda Navigator

You can now launch Conda Navigator from your system’s applications. Or you can simply type anaconda-navigator in your terminal.

Update Anaconda

You can update the anaconda using the following command.

conda update anaconda

Or you can update all the packages of Anaconda using:

conda update --all

Create the Anaconda Environment

You can create a new anaconda environment using the following command.

conda create ––name <environment-name> python=3

Activate the Anaconda Environment

To activate the anaconda environment, run:

conda activate <environment-name>

Similarly, when not in use, you can deactivate your environment.

conda deactivate

Uninstall Anaconda from Your System

It is not recommended to uninstall Anaconda directly as it will leave the system configuration settings and files.

Install Anaconda Clean

To remove all the anaconda configuration files, you need to install the following package.

conda install anaconda-clean

Now, remove the configuration files:

anaconda-clean

You can retrieve any important data later from the backup directory.

Remove Anaconda

Now you can remove Anaconda using the following rm command.

Remove Anaconda from the PATH Variable

Open the bashrc file.

nano ~/.bashrc

Next, find and delete the conda initialize block.

Now you have removed anaconda from your system.

Conclusion

This article will show you how to install and use Anaconda on your Ubuntu system. Anaconda is a free and open-source Python and R programming language distribution. The Python interpreter is included, as are several data science and machine learning packages.

Anaconda saves time as it ensures all the team members are working with the same packages and dependencies independent of the underlying operating system. It provides easy integration with complex tools like tensor flow and Keras.

Similar Posts