How to Install Anaconda on Ubuntu 18.04 and 20.04?

Anaconda is an open-source distribution of Python and R programming languages used for data science, machine learning, and artificial intelligence projects. It comes with various pre-installed libraries and packages that are useful for scientific computing, data analysis, and data visualization. This tutorial covers the complete installation and setup process for Anaconda on Ubuntu 18.04 and 20.04.

Prerequisites

Before installing Anaconda on Ubuntu 18.04 or 20.04, you should have access to a terminal window or command-line interface with superuser privileges.

Step 1: Download Anaconda

Download the Anaconda installer directly from the command line using wget. First, navigate to your home directory and download the latest version

cd ~
wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh

Alternatively, visit the official Anaconda website at https://www.anaconda.com/products/individual and download the Linux installer manually.

Step 2: Verify Download (Optional)

It's good practice to verify the integrity of the downloaded file using SHA-256 checksum

sha256sum Anaconda3-2023.09-0-Linux-x86_64.sh

Step 3: Install Anaconda

Make the installation file executable and run the installer

chmod +x Anaconda3-2023.09-0-Linux-x86_64.sh
./Anaconda3-2023.09-0-Linux-x86_64.sh

Note: Replace the filename with the actual version you downloaded.

Step 4: Follow Installation Wizard

The installation wizard will guide you through several prompts

  • License Agreement: Type yes to accept the license terms

  • Installation Location: Press Enter to use the default location (~/anaconda3)

  • Initialize Anaconda: Type yes to add Anaconda to your PATH

  • Visual Studio Code: Type no if you don't need VS Code

After installation, activate the changes

source ~/.bashrc

Step 5: Verify Installation

Test your Anaconda installation by checking the version and listing installed packages

conda --version
conda list

You should see the Conda version and a list of pre-installed packages.

Environment Management

Creating and Managing Environments

Create isolated environments for different projects

# Create new environment
conda create --name myproject python=3.9

# Activate environment
conda activate myproject

# Deactivate environment
conda deactivate

# List all environments
conda env list

# Remove environment
conda env remove --name myproject

Exporting and Sharing Environments

Create reproducible environments by exporting dependency lists

# Export current environment
conda env export > environment.yml

# Create environment from file
conda env create -f environment.yml

Package Management

Install and manage packages using both Conda and pip

# Install with conda (preferred)
conda install numpy pandas matplotlib

# Install with pip
pip install scikit-learn

# Update all packages
conda update --all

# Update specific package
conda update numpy

Using Jupyter Notebook

Anaconda includes Jupyter Notebook for interactive data analysis. Launch it with

jupyter notebook

This opens a web-based interface in your default browser where you can create and run Python notebooks.

Updating and Maintenance

Keep your Anaconda installation current

# Update conda itself
conda update conda

# Update Anaconda distribution
conda update anaconda

# Clean package cache
conda clean --all

Uninstalling Anaconda

To completely remove Anaconda from your system

# Remove installation directory
rm -rf ~/anaconda3

# Remove conda initialization from ~/.bashrc
# Edit ~/.bashrc and remove conda-related lines

# Remove hidden conda files
rm -rf ~/.conda
rm -rf ~/.continuum

Common Commands Reference

Command Description
conda info Display system information
conda search package_name Search for packages
conda install package_name Install a package
conda remove package_name Remove a package
conda env list List all environments

Conclusion

Anaconda provides a comprehensive platform for Python data science with easy package management and environment isolation. Following this installation guide, you now have a fully functional Anaconda setup on Ubuntu with the ability to create isolated environments, manage packages, and use Jupyter notebooks for your data science projects.

Updated on: 2026-03-17T09:01:38+05:30

9K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements