Anaconda is an open-source distribution and package manager for Python and R. Anaconda is a cross-platform application that can be installed on all operating systems including Ubuntu Linux. Anaconda is used to manage data science, artificial intelligence, and machine learning projects, and it also lets you create and manage isolated environments for different projects.
Anaconda comes pre-installed with more than 250 packages and the capability to install additional libraries including NumPy, pandas, PyTorch, and scikit-learn. This guide covers installing Anaconda on Ubuntu 24.04 from the official installer, updating it, fixing common errors, and using conda to manage packages and environments.
Quick Answer
Download and install Anaconda on Ubuntu 24.04 with these commands:
cd /tmp
wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
bash Anaconda3-2024.02-1-Linux-x86_64.sh
Follow the prompts, accept the license, then activate the environment with source ~/.bashrc. Verify with conda --version.
How to Install Anaconda on Ubuntu 24.04
Ubuntu does not include the Anaconda package in its official repository, so you need to download the installer via wget from the official website and then run it with the bash command. This same wget-then-install workflow is also used when you want to install Skype on Ubuntu 24.04 using its official .deb installer. Check the following steps to install Anaconda on Ubuntu 24.04.
Step 1: Update System Repositories
Press CTRL + Alt + T to open the Terminal and ensure that system packages are updated to their latest version by running this command:
sudo apt update && sudo apt upgrade

Step 2: Download Anaconda
Before downloading Anaconda, change the current working directory to /tmp. The /tmp directory stores files temporarily and deletes them when you close the session:
cd /tmp

Download the Anaconda installer file from the official Anaconda website. Locate the desired Linux x64 version, copy its link, and provide it to the wget command:
wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
Note: Downloading Anaconda will take time, so be patient.

Note: If you do not have the wget utility installed, run this command to install it:
sudo apt install wget
Step 3: Check Anaconda Package Integrity
Once the Anaconda setup file is downloaded, use the checksum utility to make sure it is not corrupted and safe to install on Ubuntu:
sha256sum Anaconda3-2024.02-1-Linux-x86_64.sh

Step 4: Install Anaconda
Once you are sure the Anaconda file is safe to install, run the given script to begin the installation:
bash Anaconda3-2024.02-1-Linux-x86_64.sh
After executing this command, press the Enter button to proceed with the installation:

You will be presented with the End User License Agreement. Keep pressing Enter to read through it:

Once you read it completely, type yes and press Enter to accept the Anaconda license terms:

Press Enter to install Anaconda in the default Home directory, or specify a different location:

Once the installation is finished, type yes and press Enter to initialize Anaconda on startup, or type no to activate it manually later:

Close and restart the Terminal so that the Anaconda environment changes take effect:

Step 5: Activate Anaconda Environment
After installing Anaconda, activate the working environment to start using it. Run this command to reload the .bashrc file and activate the Anaconda base environment:
source ~/.bashrc

Step 6: Verify Installation
Verify the Anaconda installation by checking its complete information with this command:
conda info

Alternatively, you can verify the Anaconda installation by checking its version with this command:
conda --version

How to Update Anaconda on Ubuntu 24.04
If you have already installed Anaconda on Ubuntu and want to upgrade it to the latest version, first update the conda package manager by running this command:
conda update conda

Once the package manager is updated, run this command to update Anaconda itself:
conda update anaconda

How to Fix the “PackageNotInstalledError: Package is not installed in prefix” Error
While updating Anaconda on Ubuntu using the conda update anaconda command, you may encounter the “PackageNotInstalledError: Package is not installed in prefix” error in the Terminal:
conda update anaconda

To fix the “PackageNotInstalledError: Package is not installed in prefix” error, execute the conda install anaconda command:
conda install anaconda
Note: When the prompt asks for confirmation, type y and press Enter:

Once this command completes, you can then run conda update anaconda successfully.
How to Use Anaconda on Ubuntu 24.04
Here are the essential conda commands for managing packages and environments on Ubuntu 24.04. If you also need a browser for web-based Jupyter notebook access, Chromium on Ubuntu 24.04 is a lightweight option to install alongside Anaconda.
Usage 1: List Installed Anaconda Packages
You can retrieve the list of installed packages in the active Anaconda environment by running this command:
conda list

Usage 2: Install Python Package Using Anaconda
You can install any Python package by specifying the package name to the conda install command:
conda install pandas

Usage 3: Create an Environment Using Anaconda
To create an isolated environment, use the conda create command and specify the environment name with the –name flag:
conda create --name env_1

Usage 4: Activate an Environment using Anaconda
Activate an environment by specifying the environment name to the conda activate command:
conda activate env_1

Usage 5: Deactivate an Environment using Anaconda
To deactivate the current environment and return to the base, simply run this command:
conda deactivate

How to Uninstall Anaconda from Ubuntu 24.04
You cannot directly remove Anaconda from Ubuntu 24.04 with a single apt command, since Anaconda installs to the home directory rather than system paths. Unlike packages you might build and install as Debian packages, Anaconda requires its own cleanup utility. First, install the anaconda-clean package:
conda install anaconda-clean

Now, run the anaconda-clean package to remove Anaconda configuration files from Ubuntu:
anaconda-clean
Type y and press Enter to confirm removal of each Anaconda file:

To completely remove Anaconda from Ubuntu along with its installation directory, run this command:
rm -rf ~/anaconda3
