Install Anaconda in Ubuntu 22.04 – Tutorial for Beginners

Install Anaconda in Ubuntu 22.04 – Tutorial for Beginners

You might find Anaconda useful if you are interested in data science, machine learning, or scientific computing. Anaconda is a widely recognized Python distribution that simplifies package management and deployment. In this guide, you will learn how to install Anaconda on Ubuntu 22.04, one of the latest long-term support (LTS) versions of the well-known Linux distribution.

Advantages of Anaconda

  • Before we begin the installation process, let’s briefly discuss why Anaconda is a popular choice among Python developers and data scientists:
  • Package Management: Anaconda simplifies package management with its package manager, Conda. Conda allows easy installation, updating, and removal of packages while ensuring compatibility and reproducibility of Python environments.
  • Python Environment Management: Anaconda allows for creating isolated Python environments, essential for managing different Python versions and dependencies for multiple projects.
  • Data Science Ecosystem: Anaconda includes commonly used libraries and tools for data science like NumPy, pandas, SciPy, scikit-learn, and Jupyter Notebook.
  • Cross-Platform: Anaconda is a versatile platform for Windows, macOS, and Linux, suitable for diverse development environments.
  • Community and Support: Anaconda has a thriving community with ample documentation, tutorials, and user support.

Now, let’s proceed with the installation.

Steps To Install Anaconda in Ubuntu 22.04

Step 1: Upgrade the System Packages List

Before installing any software, ensuring your system’s package list is current is essential. Open your terminal and run:

sudo apt update

This command refreshes the list of available packages.

Step 2: Install Curl and bzip

Curl and bzip2 are required to download and extract the Anaconda installer. Install them by running:

sudo apt install curl bzip2

or

sudo apt install curl bzip2 -y

These packages are essential for the installation process. You can use the -y flag to automatically answer ‘yes’ to the confirmation prompt that appears when installing packages. With this flag, you don’t need to confirm the installation manually; it will proceed automatically.

Check our developer-friendly Python Hosting!

Step 3: Download the Bash Script for the Anaconda Installer

Visit the Anaconda website (https://www.anaconda.com/products/distribution) and download the Linux version of Anaconda. Replace <version> with the specific version you intend to install.

or

You can use the following curl command to download the Anaconda installer script for version 2023.07.2 for Linux 64-bit:

curl --output anaconda3.sh https://repo.anaconda.com/archive/Anaconda3-2023.07-2-Linux-x86_64.sh

This will download the Anaconda installer script to your current directory, and you can proceed with the installation steps.

Step 4: Verify Data Integrity

To ensure the downloaded installer is not corrupted, verify its data integrity using SHA-256 checksums. Run the following command :

sha256sum anaconda3.sh

Compare the output with the checksum provided on the Anaconda website.

Ensure you download the correct Anaconda version, verify the installer’s checksum, and avoid using sudo. Check for sufficient disk space and read the prompts to avoid conflicts with existing Python installations.

Step 5: Install Anaconda in Ubuntu 22.04

Make the Anaconda installer script executable:

chmod +x Anaconda3.sh

Execute the installer script:

./Anaconda3.sh

Follow the on-screen prompts. You’ll need to review the license agreement and choose the installation location (the default is typically fine). Additionally, initialize Anaconda by typing ‘yes’ when prompted.

Sign up and avail $100 free credits now!!

Step 6: Activate the Anaconda Environment

After the installation, you should close and reopen your terminal to activate the Anaconda environment. You can do this by running:

conda init

Step 7: Verify Installation

You can verify the successful installation of Anaconda by checking its version:

conda --version

This should display the Conda version.

How to Uninstall Anaconda from Ubuntu 22.04

If you ever need to uninstall Anaconda from your Ubuntu system, you can do so by following these steps:

Remove the Anaconda installation directory (the default is typically /home/your-username/anaconda3/).

Remove the Anaconda entry from your .bashrc file by opening it in a text editor:

nano ~/.bashrc

Locate the Anaconda-related lines and delete or comment on them.

Close and reopen your terminal for changes to take effect.

Register and get Auto Scalable instances with a Pay-As-You-Go Pricing Model!

FAQs for Install Anaconda in Ubuntu 22.04

Q1: Can I install Anaconda alongside an existing Python installation?
A1: Yes, Anaconda allows you to create isolated Python environments. You can install Anaconda without interfering with your system’s default Python installation.

Q2: Is Anaconda free to use?
A2: Yes, Anaconda Individual Edition, which includes most of its essential features, is free to use. Anaconda also offers a paid version called Anaconda Team Edition with additional features for enterprises.

Q3: How do I update Anaconda packages?
A3: You can update all Anaconda packages with the command:

conda update --all

Conclusion

Installing Anaconda on Ubuntu 22.04 is a straightforward process that provides you with a powerful Python distribution and a wide range of tools for data science and development. With Anaconda’s package management and environment capabilities, you’ll have a robust platform for your Python projects. Start exploring the world of data science, machine learning, and scientific computing with Anaconda on your Ubuntu system today!

To run the program, save it as cal.py and execute it using Python 3:

python3 cal.py