How to Install Anaconda on Ubuntu


Anaconda is a widely used open-source Python distribution available on various operating systems, including Linux, Windows, and macOS. It provides a comprehensive suite of tools and libraries tailored for data science and machine learning.

This step-by-step guide shows you how to install Anaconda on Ubuntu.

How to install Anaconda on Ubuntu


  • Ubuntu system (this tutorial uses Ubuntu 22.04).
  • A user account with sudo privileges.
  • Access to the terminal.

How to Install Anaconda on Ubuntu.

Anaconda simplifies the installation and management of Python and its associated libraries on Ubuntu. Installing Anaconda is straightforward and starts with updating the local package manager with this command:

sudo apt update

After the update completes, proceed with the steps explained in the following sections.

Step 1: Download the Latest Version of Anaconda

To download Anaconda, go to the developer's download page. At the time of writing this article, the latest version of Anaconda was 2023.09.

Anaconda developers website

Note the URL of the version you want to download and take the following steps:

1. Navigate to the /tmp directory in the terminal. This directory is commonly used for temporary file storage.

cd /tmp
cd /tmp terminal output

2. Use the curl command to download the installer:

curl -O [URL]

The -O argument instructs curl to save the downloaded file with the same name as the file in the URL. Replace the URL with the URL from the developer's page. In this case, it is:

curl -O
curl -o terminal output

If you don't have curl installed on your system, run sudo apt install curl.

3. Verify the download file has not been altered or corrupted during the download process using the checksum tool:

sha256sum terminal output

Compare the output to the appropriate checksum (or hash) in the Anaconda documentation.

compare  letters and numbers with downloaded file checksum

If the checksums are identical, the downloaded Anaconda installer file is the same as the original file provided by the official source. This verification process confirms the file has not been tampered with or corrupted during the download.

Step 2: Run Anaconda Installation Script

The Anaconda installer is a bash script. Therefore, running the Anaconda installer executes a series of bash commands and scripts that handle the installation process.

To install Anaconda, take the following steps:

1. Run the bash script:


2. A license agreement appears. Use Enter to review the agreement and type yes at the bottom to agree.

Accepting license agreement

3. The installer prompts users to accept the default location or install to a different location. Use the default path unless you have a specific need to change it.

Confirm the location

4. Finish installation and determine whether to automatically initialize conda at startup. Type yes after the prompt unless you have a specific reason for doing otherwise.

Installation completed

Once the installation is completed, close and reopen the shell to confirm the changes took effect. The Anaconda base environment activates by default, which means it is set as the active Python environment in the shell.

Step 3: Activate and Test Installation

During the Anaconda installation process, the installer adds lines to the .bashrc file to update the system's PATH variable. For changes to take effect, run:

source ~/.bashrc

The command has no output. Use the conda command to test the installation:

conda info
conda info terminal output

If the command returns information about the conda installation without any errors, then Anaconda is installed and configured properly on the system.

How to Update Anaconda on Ubuntu

Updating Anaconda ensures the latest package manager and distribution versions are installed. To update Anaconda on Ubuntu, take the following steps:

1. Update the conda package manager:

conda update conda
conda update conda terminal output

The command updates to the package manager's latest version, including bug fixes, performance improvements, and new features.

2. Update the Anaconda distribution with:

conda update anaconda
Terminal output for conda update anaconda

This updates all the packages included in the Anaconda distribution to their latest versions.

How to Uninstall Anaconda from Ubuntu

In case you are no longer using Anaconda, take the following steps to uninstall it:

1. Install the anaconda clean package with:

conda install anaconda-clean
conda install anaconda clean terminal output

Anaconda clean is a tool that cleans up unnecessary files and directories associated with Anaconda installations.

2. Delete cache, logs, and temporary files with:

anaconda clean terminal output

Type y or n for each prompt.

3. Remove the entire Anaconda directory with the following command:

rm -rf ~/anaconda3
rm -rf ~/anaconda3 terminal output

The command has no output, but it deletes the Anaconda installation directory and all its contents, including files, directories, and subdirectories. This action is irreversible.

4. Remove Anaconda from PATH by editing the .bashrc file. To do so, open a text editor of choice. This tutorial uses Vim:

vim ~/.bashrc

Scroll down to the end of the file and delete the Anaconda block. Save and exit the file.

Editing conda section in .bashrc file

These four steps remove Anaconda from the system.


After reading this article, you know how to install and update Anaconda in Ubuntu. You are also now familiar with how to remove Anaconda from an Ubuntu system.

Next, learn how to install Python independently on Ubuntu.

Was this article helpful?
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
How to Install Docker Compose on Ubuntu 18.04
June 10, 2019

Docker Compose is a software package that modifies the behavior of Docker. Docker creates a specific...
Read more
How to Install XAMPP on Ubuntu 18.04
February 22, 2024

The XAMPP stack is an open-source Apache distribution of a PHP development environment consisting of...
Read more
How to Install Kubernetes on Ubuntu 18.04
December 13, 2023

Kubernetes is a management platform for Docker containers. Docker lets you create containers for a...
Read more
How to Install Pip on Ubuntu 18.04
February 20, 2019

Pip is a software utility that downloads packages from PyPI - the Python Package Index. Using PIP is like...
Read more