Anaconda is an essential tool for data scientists and developers working in Python and R. It simplifies package management and deployment, offering a collection of over 1500 data science packages. This guide provides detailed steps to install Anaconda on Ubuntu 24.04, including setting up environments and basic usage.
In this tutorial you will learn:
- Downloading and Installing Anaconda
- Completing the Installation Process
- Setting up the Environment
- Understanding and Managing Anaconda Environments
- Testing the Installation with a Simple Python Script
The following steps will guide you through the process of installing Anaconda on your Ubuntu 24.04 system.
- Downloading the Anaconda Installer
Visit the Anaconda website and download the latest version of Anaconda for Linux. The installer file will typically be named like
- Running the Installation Script
Open a terminal, navigate to the download directory, and execute the script:
$ bash Anaconda3-2023.09-0-Linux-x86_64.sh
Follow the on-screen instructions to accept the license agreement and confirm installation settings.
- Completing the Installation
The installation process will unpack and install Anaconda. During the process, choose to initialize Anaconda by updating your shell profile, enabling automatic activation of the base environment.
- Setting Up the Environment
Restart your terminal or source the
.bashrcfile to refresh the environment variables:
$ source ~/.bashrc
After this, you should see a
(base)prefix in your terminal, indicating the base Anaconda environment is active.
- Understanding Anaconda Environments
Anaconda allows the creation of isolated environments for different projects. The
(base)environment is the default, but you can create and activate new environments as needed. To deactivate the base environment automatically on terminal startup, run:
$ conda config --set auto_activate_base false
To activate an environment manually, use:
$ conda activate <env_name>
To list installed anaconda environments run:
$ conda env list
To return to the base environment:
$ conda activate base
Remember that you need to restart your terminal or source the
.bashrcfile to refresh the environment variables.
- Testing with a Simple Python Program
To test your installation, create a simple Python script,
hello_world.py, with the content:
$ print("Hello, World!")
Run the script in the Anaconda environment:
$ python hello_world.py
Successful output confirms a functional Anaconda installation.
Congratulations! You have successfully installed Anaconda on Ubuntu 22.04. This powerful platform is now ready for your data science and machine learning projects. With the knowledge of managing environments, you can maintain organized, efficient workflows and manage dependencies effectively for each project.