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
Terminal output of sudo apt update and upgrade on Ubuntu 24.04

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
Terminal showing the current directory changed to /tmp on Ubuntu 24.04

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.

Terminal output of wget downloading the Anaconda installer on Ubuntu 24.04

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
Terminal showing sha256sum output to verify the Anaconda installer integrity

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:

Terminal showing the Anaconda installer starting with a prompt to press ENTER to continue

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

Terminal showing the Anaconda End User License Agreement screen

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

Terminal showing the prompt to accept Anaconda license terms by typing yes

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

Terminal showing the Anaconda installation location prompt with default Home directory selected

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

Terminal showing the prompt to initialize Anaconda on startup

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

Terminal showing Anaconda installation complete with instructions to close and reopen the shell

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
Terminal showing source ~/.bashrc activating the Anaconda base environment

Step 6: Verify Installation

Verify the Anaconda installation by checking its complete information with this command:

conda info
Terminal output of conda info showing Anaconda installation details on Ubuntu 24.04

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

conda --version
Terminal showing conda --version output confirming Anaconda is installed on Ubuntu 24.04

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
Terminal output of conda update conda on Ubuntu 24.04

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

conda update anaconda
Terminal output of conda update anaconda on Ubuntu 24.04

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
Terminal showing the PackageNotInstalledError when running 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:

Terminal output of conda install anaconda resolving the PackageNotInstalledError on Ubuntu 24.04

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
Terminal output of conda list showing installed Anaconda packages on Ubuntu 24.04

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
Terminal output of conda install pandas on Ubuntu 24.04

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
Terminal output of conda create --name env_1 creating a new Anaconda environment

Usage 4: Activate an Environment using Anaconda

Activate an environment by specifying the environment name to the conda activate command:

conda activate env_1
Terminal showing conda activate env_1 switching to the named Anaconda environment

Usage 5: Deactivate an Environment using Anaconda

To deactivate the current environment and return to the base, simply run this command:

conda deactivate
Terminal showing conda deactivate returning to the base Anaconda environment

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
Terminal output of conda install anaconda-clean on Ubuntu 24.04

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:

Terminal showing anaconda-clean prompting to confirm removal of Anaconda files

To completely remove Anaconda from Ubuntu along with its installation directory, run this command:

rm -rf ~/anaconda3
Terminal showing the rm -rf ~/anaconda3 command removing the Anaconda installation directory