
Anaconda is an open-source distribution for Python and R programming languages that streamlines package and dependency management, making it ideal for data science. Installing Anaconda on Ubuntu 24.04 provides access to the Conda package manager, along with a rich collection of pre-built machine learning libraries and tools.
This article explains how to install Anaconda on Ubuntu 24.04 and manage isolated user environments using Conda. If you're using a different version or distribution, check out our guides on How to install Anaconda on Ubuntu 22.04 and How to install Anaconda on Debian 12.
Before you begin:
Anaconda is not available in the default Ubuntu package repositories. In this guide, we are installing Anaconda3 for Ubuntu by downloading and running the installation script from the official Anaconda repository. Follow the steps below to proceed with the installation.
Visit the Anaconda archives directory to check and download the latest installation script.
Run the script using Bash.
Press Enter when prompted to review the Anaconda license agreement.
Press Space to browse through the license agreement.
Enter yes and press Enter to accept the license agreement.
Verify the default installation path, typically anaconda3 in your user home directory and press Enter to install Anaconda.
Enter yes and press Enter to update your shell environment and initialize Conda.
Reload the .bashrc shell configuration to apply the Anaconda changes to your environment.
View the installed Conda version.
Output:
List all packages in the default Conda environment.
Output:
A Conda environment contains specific dependencies, packages, and Python versions that match your project needs. The isolated environment is different from your global system environment. Follow the steps below to create and manage Conda environments.
Create a new myenv Conda environment with a specific Python version, such as 3.8.
Enter Y when prompted to install all necessary dependency packages in the new environment.
Activate the new Conda environment.
Verify that your shell prompt changes to the new environment.
List all outdated packages in your environment.
Enter Y when prompted to install new packages.
Create a test environment by cloning the existing myenv environment.
Install a new package, such as requests in the environment.
To install packages from different sources like conda-forge, run conda install -c conda-forge package_name and replace package_name with the name of the package that you want to install.
Clear all unused packages and caches from your environment.
Export the Conda environment to a file like environment.yml.
Import the environment to reinstall all necessary packages and dependencies.
Use conda run to execute commands in a specific environment without activating it. For example, run the script.py file in the myenv environment.
Output:
You have installed Anaconda on Ubuntu 24.04 and managed Conda environments on the server. Anaconda provides an advanced platform for managing dependency and packages to match your project's needs. Use Anaconda when running multiple projects that require different packages and dependencies. For more information, please visit the official Anaconda documentation.
0 Comments
Be the first to comment and share your perspective with the community.