×


Install Anaconda on Ubuntu 20.04 - Step by step guide ?

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.

Here at Ibmi Media, we shall look into how to install, use, and remove Anaconda from your Ubuntu operating system.


Steps to install Anaconda on your Ubuntu 20.04

1. 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


2. 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


3. 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 license terms. Type yes to proceed.

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

Once installation is finished, Initialize 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 initialize 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.


How to launch Conda Navigator ?

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

$ anaconda-navigator


How to 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


How to Create the Anaconda Environment ?

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

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


How to 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


How to Uninstall Anaconda from Your Ubuntu System ?

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

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.

Now you can remove Anaconda using the following rm command:

$ rm -rf ~/anaconda3 ~/.condarc ~/.conda ~/.continuum

To Remove Anaconda from the PATH Variable

Open the bashrc file:

$ nano ~/.bashrc

Next, find and delete the conda initialize block.

Save and close the file when you are finished.

Now you have removed anaconda from your system.


[Need help in fixing Linux system issues ? We can help you. ]


Conclusion

This article covers 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.