Unveiling the 5 Key Steps to Deploy Anaconda on Ubuntu Linux

Published January 18, 2024

Unveiling the 5 Key Steps to Deploy Anaconda on Ubuntu Linux.

Unlocking the Power of Anaconda: Dive into a seamless installation process for Python and R on Linux Ubuntu. Discover the simplicity of managing libraries and dependencies, tailored for data science, machine learning, and artificial intelligence enthusiasts.Anaconda

Explore More; Quantifying Network Speed on the Linux Operating

System.

Installing Anaconda on your operating system makes managing libraries, packages, and dependencies easy and optimized. Due to these valuable features of Anaconda and the needs of scientific communities, we have decided to provide a step-by-step guide on how to install Anaconda in Linux Ubuntu in this article. If you work in the domains of data science, machine learning, scientific computing, and artificial intelligence, read this guide to the end to benefit from Anaconda features on Linux.

Why install Anaconda in Ubuntu?

Explore the Benefits: Learn about the key features and advantages of installing Anaconda on Ubuntu Linux in this section of the article. Discover the usefulness of integrating Anaconda for various purposes.

  • Anaconda is a simple and efficient way to install and manage a comprehensive set of tools, libraries, and data science packages.
  • Provides the ability to update, install, and remove packages and dependencies through Conda package management.
  • Offers an integrated development environment (IDE) and interactive development environment for visualization, experimentation, and data analysis, supporting tools such as Jupyter Notebook, JupyterLab, and Spyder.
  • Includes a vast collection (over 1,000) of pre-configured packages and libraries used in data science and scientific computing (libraries such as NumPy, pandas, Matplotlib, scikit-learn, TensorFlow, PyTorch, and more).
  • Enables the creation of isolated Python environments to prevent compatibility issues and conflicts between different projects with specific library versions and configurations.
  • Ensures stability across different platforms in Ubuntu Linux and plays an effective role in facilitating collaboration and project sharing with team members using various operating systems.
  • Has a large and active community that provides resources, tutorials, and support.
  • Optimizes the performance of various libraries, which is helpful for data-intensive and computationally demanding tasks.
  • Guarantees security updates, bug fixes, and access to the latest features for tools and libraries by keeping the installed packages up to date.

Prerequisites Anaconda installation in Ubuntu

Prepare for Installation: Before you embark on the Anaconda installation journey in Ubuntu, ensure the following prerequisites:

  1. Possess access to an Ubuntu system or Ubuntu VPS.
  2. Verify and allocate ample resources (CPU, memory, storage) to smoothly handle both the installation process and subsequent use of Anaconda, especially when dealing with extensive datasets or resource-intensive computations.
  3. Hold sudo (superuser) privileges to facilitate software installation.
  4. Keep your system updated by executing the command sudo apt update to refresh package lists for upgrades and new installations.
  5. Ensure a steadfast and dependable internet connection for the seamless download and installation of Anaconda.
  6. Prioritize the installation of Python on your Ubuntu VPS.
  7. Don’t forget to install R on your Ubuntu system.

Quick Guide to Install Anaconda on Linux Ubuntu

Experience the simplicity of installing Anaconda on Ubuntu with these 5 easy steps:

1. Download and Install Anaconda

The simplest and most common method to install Anaconda is to download the latest Anaconda installer bash script.

After connecting to your Ubuntu VPS, updating and synchronizing repositories, and installing packages, initiate the Anaconda installation by first downloading the suitable version from the Anaconda download page.

Navigate to the page to identify the latest and most fitting version (typically the 64-bit version) for your Ubuntu system. Next, access the /tmp directory. Although the Downloads directory often houses recent downloads, it’s advisable to transfer the Anaconda installer script to the /tmp directory for items you won’t require post-installation.

Open the Ubuntu terminal by pressing Ctrl + Alt + T or searching for “Terminal” in the programs menu. Navigate to the desired directory for the Anaconda installer script using the cd (change directory) command.

cd /tmp

The curl command helps download the link from the official Anaconda site, so run the following command to download the latest version of Anaconda in your Ubuntu system:

curl https://repo.anaconda.com/archive/ Anaconda3-2023.09-0-Linux-x86_64.sh –output anaconda.sh

To save time and effort, we saved the command’s output to a file called anaconda.sh using the --output anaconda.sh option.

2. Verify the data integrity of the installer

After completing the download, use the SHA-256 checksum to verify the data integrity of the installer with cryptographic hash verification:

sha256sum anaconda.sh

The output will show the cryptographic hash verification for the installed Anaconda version. It needs to match the SHA256 for the Anaconda version on the official website.

Once you confirm that the hash displayed on the website matches the output, proceed with the installation by running the Anaconda bash shell script.

bash anaconda.sh

Output:

Welcome to Anaconda3 2023.09-0 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>>

Receiving a welcome message in the output of the Anaconda script execution command indicates a successful installation of Anaconda in Ubuntu Linux. As the output informs you, to proceed, press the Enter key.

Then, follow a series of prompts on the screen to review the license agreement, choose the installation location, and continue with the installation.

3. Follow the Installation Wizard

To proceed, carefully review the license and press Enter to indicate your acceptance. Subsequently, you will encounter a prompt asking you to agree to the terms and conditions. Respond by typing ‘yes’ when prompted with the content ‘Do you approve the license terms? [yes|no]’. Finally, you’ll need to specify the installation location.

Press Enter to opt for the default location instead of configuring a specific one.

Output:

Anaconda3 will now be installed into this location: /root/anaconda3 – Press ENTER to confirm the location – Press CTRL-C to abort the installation – Or specify a different location below [/root/anaconda3] >>>

The next prompt indicates the completion of the installation process, which will be completed after a few minutes of waiting. After the installation process is complete, you will receive the following output:

Output:

… installation finished. Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no] [no] >>>

Finally, to initialize Anaconda3, type Yes and press Enter.

4. Activate Anaconda

Upon completion of the installation, activate Anaconda by executing the following command:

source ~/.bashrc

Alternatively, you can close and reopen the terminal to activate Anaconda.

By activating Anaconda, you enter the base Anaconda programming environment.

5. Verify Installation

Verify the installation by running the following command and observing information about the Anaconda installation:

conda info

Alternatively, you can also run the following command and confirm the installation by checking the Conda version:

conda –version

Congratulations! With Anaconda now successfully installed on your Ubuntu system, you’re all set to create and manage Python environments using Conda.

Navigating the Anaconda Update

To ensure optimal performance, it’s crucial to regularly update Anaconda. A good practice is to update Conda to the latest version, enhancing your ability to create and manage environments.

Execute the following command for this purpose:

conda update -n base -c defaults conda

Or

conda update conda

After updating Conda, then update the Anaconda distribution by running the following command:

conda update anaconda

After running the previous commands, type y and press Enter.

Instructions for Configuring Anaconda Environments in Ubuntu

Experience the benefits of setting up Anaconda environments on Ubuntu, where you can establish isolated Python environments to manage diverse versions of libraries and packages for various projects.

This ensures the preservation of project-specific configurations and coherence.

Delve into this section of the article for insights into creating and managing Anaconda environments.

Create a New Environment:

To create a new Anaconda environment, you’ll need to specify a name for the desired environment and the desired Python version. Therefore, examining the available Python versions is a crucial step.

To find out which Python versions are available, use the following command:

conda search “^python$”

Corresponding to the Anaconda version, you will have access to a set of Python package versions. Since Anaconda is used with Python 3 in this article, Python 3 package versions will be available.

Then, to create a new Anaconda environment using the desired Python version, run the following command:

conda create –name myenv python=python_version

Replace “myenv” with your desired environment name and “python_version” with the Python version you want, and type y to confirm the output and the information given about the packages that will be installed.

Activate the Environment:

To utilize the Anaconda environment you crafted in Ubuntu, activate the new environment by executing the following command:

conda activate myenv

Upon activating the new environment, your command prompt prefix will indicate your entry into the new environment.

Verify Python Version of the Environment:

To ensure whether the newly created environment is using your desired Python version or not, the following command is useful:

python –version

The previous command’s output displays the Python version used in the Anaconda environment.

Install Packages to Environment:

Every environment you create in Anaconda includes default packages such as openssl, ncurses, libedit, ca-certificates, sqlite, zlib, python, wheel, pip, and so on. After activating the new Anaconda environment, you can install specific packages in the new environment using the command conda install.

For example:

conda install numpy pandas matplotlib

Deactivate the Environment:

To return to the base environment and deactivate the current environment, use the following command:

conda deactivate

List Environments:

To check all the environments you have created, you can type the following command:

conda env list

This command outputs a list of created environments. Alternatively, you can use the following command to inspect all of the environments:

conda info –envs

In the output, the environment with an asterisk is the currently active environment.

Remove an Environment:

When you don’t need a specific environment to use in the project, you can remove it by running the following command:

conda env remove –name myenv

replace myenv with the environment name you want to remove.

Then, to confirm the removal of the specific environment, you can run the conda info --envs command.

Uninstalling Anaconda in Ubuntu

If you’ve determined that Anaconda is no longer required, uninstall it from your Ubuntu system with a few simple commands.

Begin by installing the anaconda-clean module to remove Anaconda configuration files from your system.

install anaconda-clean

After installing the anaconda-clean module, run the following command to delete all Anaconda-related files and directories:

anaconda-clean

To streamline the removal process of each Anaconda configuration file, add the ‘– yes’ option at the end of the command to eliminate the need for manual confirmation (‘y’ input).

Execute the following command to remove all pertinent directories for Anaconda:

rm -rf ~/anaconda3

To ensure the complete removal of Anaconda from your Ubuntu system, you can delete the PATH line that Anaconda added to your .bashrc file. First, access the content of the file using your preferred text editor:

nano ~/.bashrc

In the file’s content, look for Anaconda; after finding it, delete or comment out the Anaconda block. After editing the content, type “CTRL + X” to exit the file and save your changes by typing “y.”

As a result, you have now completely cleaned your Ubuntu system from the Anaconda program.

Explore More; Launching Linux from USB on a Windows Computer
Stay Connected on Meta , X, Instagram .