Choose a different version or distribution
Introduction
Before we begin talking about how to install Anaconda on Ubuntu 24.04, let's briefly understand – What is Anaconda?
Anaconda is a popular open-source platform that simplifies the process of data science and machine learning workflows. It comes with a package management system, making it easy to install, manage, and update various data science tools and libraries.
Anaconda includes essential components like Python programming language, Jupyter notebooks, and more, allowing users to streamline their data analysis and model development tasks efficiently. With Anaconda, users can create scalable and reproducible data science projects with ease.
In this tutorial, you will install Anaconda on Ubuntu 24.04. We will also address a few FAQs on how to install Anaconda on Ubuntu 24.04.
Advantages of Anaconda
- Package Management: Anaconda simplifies the installation and management of data science libraries effectively.
- Ease of Use: User-friendly interface and tools like Jupyter notebooks enhance workflow efficiency.
- Reproducibility: Ensures project scalability and reproducibility across different environments.
- Community Support: Access to an active community for problem-solving and collaboration.
- Wide Compatibility: Works seamlessly across various platforms, supporting Python and R languages.
How to Install Anaconda on Ubuntu 24.04
Ubuntu does not have the Anaconda package in its official repository. Therefore, it is necessary to download the Anaconda package from its official website using the wget
command and then install it with the bash command. Follow these steps to install Anaconda on Ubuntu 24.04.
Step 1: Update System Repositories
Press CTRL + Alt + T
to open the Terminal, and then run the following command to update or upgrade system packages to their latest version:
sudo apt update && sudo apt upgrade
Step 2: Download Anaconda
Before downloading Anaconda on Ubuntu, change the current working directory to the /tmp
directory, which stores files temporarily and deletes them when you close the session. To change to the /tmp
directory, run this command:
cd /tmp
After changing your current working directory to the /tmp
directory, download the Anaconda installer file. Visit the official Anaconda website, locate the desired Linux x64 version, copy its link, and use it with the wget
command to download the Anaconda setup on Ubuntu:
wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
Note: Downloading Anaconda may take some time, so please be patient.
Note: If the wget
utility is not installed, run the following command to install it on Ubuntu:
sudo apt install wget
Step 3: Check Anaconda Package Integrity
After downloading the Anaconda setup file, use the checksum utility to verify that it is not corrupted and safe to install on Ubuntu:
sha256sum Anaconda3-2024.02-1-Linux-x86_64.sh
Step 4: Install Anaconda
After verifying that the Anaconda file is safe to install, run the following script to install Anaconda on Ubuntu:
bash Anaconda3-2024.02-1-Linux-x86_64.sh
After executing this command, press Enter to proceed with the installation, as illustrated below:
You will see the End User License Agreement. Press Enter repeatedly to read through it:
After reading, it thoroughly, type 'yes' and press Enter to accept the Anaconda license terms:
Next, press Enter to install Anaconda in the default location, which is the Home directory, or specify a different location if desired:
After the installation is complete, type 'yes' and press Enter to enable Anaconda to start automatically on startup, or type 'no' if you prefer to start and activate it manually later:
Finally, close and reopen the Terminal to apply the changes to the Anaconda environment.
Step 5: Activate Anaconda Environment
After installing Anaconda, you must activate the Anaconda environment to use it. Run this command to activate the Anaconda environment:
source ~/.bashrc
This command will reload the .bashrc
file, saving the changes and activating the Anaconda environment:
Step 6: Verify Installation
After installing Anaconda on Ubuntu, verify the installation by running this command in the Terminal to check its complete information:
conda info
Alternatively, you can verify the Anaconda installation on Ubuntu by checking its version with the following command:
conda --version
How to Update Anaconda on Ubuntu 24.04
If you have already installed Anaconda on Ubuntu and want to upgrade to the latest version, you first need to update the Anaconda package manager by running this command:
conda update conda
After updating the package manager, update Anaconda by running this command:
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 resolve the PackageNotInstalledError: Package is not installed in prefix
error, simply run the conda install anaconda
command, as shown below:
conda install anaconda
Note: When prompted for confirmation, type 'y' and press Enter:
After executing the above command, you can update Anaconda by running the conda update anaconda
command.
How to Use Anaconda on Ubuntu 24.04
Anaconda is now installed on Ubuntu 24.04. Next, let’s explore how to manage and use Anaconda on Ubuntu. Follow these steps to learn how to use Anaconda on Ubuntu 24.04.
Usage 1: List Installed Anaconda Packages
You can view the list of installed packages on Ubuntu by running this command:
conda list
Usage 2: Install Python Package Using Anaconda
You can install any Python package on Ubuntu by specifying the package name with the conda install
command, as shown below:
conda install pandas
Usage 3: Create an Environment Using Anaconda
To create an environment on Ubuntu, use the conda create
command and specify the environment name with the --name
flag, as shown below:
conda create --name env_1
Usage 4: Activate an Environment using Anaconda
You can activate the environment in Anaconda by providing the environment name with the conda activate
command, as shown below:
conda activate env_1
Usage 5: Deactivate an Environment using Anaconda
To deactivate the environment, simply run the following command:
conda deactivate
How to Uninstall Anaconda from Ubuntu 24.04
You cannot directly remove Anaconda from Ubuntu 24.04. However, to remove Anaconda, you first need to install the anaconda-clean
package. Run this command to install the anaconda-clean
package:
conda install anaconda-clean
Next, run the anaconda-clean
package to remove Anaconda from Ubuntu, as shown below:
anaconda-clean
Type 'y' and press Enter to remove Anaconda from Ubuntu:
To completely remove Anaconda from Ubuntu, including its directory, run this command:
rm -rf ~/anaconda3
FAQs to Install Anaconda on Ubuntu 24.04
Do I need root access to install Anaconda?
No, you can install Anaconda in your home directory without root access.
What is the base environment in Anaconda?
The base environment is the default environment created during installation, which contains the core Anaconda packages.
How can I list all Anaconda environments?
Use the command: conda env list
to see all your environments.
What is Anaconda Navigator?
Anaconda Navigator is a graphical interface for managing packages and environments in Anaconda.
How do I test if Anaconda is installed correctly?
Create a simple Python script and run it in the Anaconda environment to confirm functionality.
Is Anaconda free to use?
Yes, Anaconda is free for individual users, but there are paid options for enterprise use.
What are some common commands I should know?
Key commands include conda create
, conda activate
, conda install
, conda update
, and conda remove
.
Conclusion
We hope this tutorial helped you understand how to install Anaconda on Ubuntu 24.04.
If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.