Installing Anaconda Python on Ubuntu for UltraLinux

This guide provides step-by-step instructions for installing Anaconda, a popular Python distribution for data science and machine learning, on an Ubuntu system. While tailored for users interested in the UltraLinux project (https://ultralinux.org/), which focuses on porting Linux to SPARC processors, this tutorial assumes you are working on an Ubuntu environment, either natively or via the Windows Subsystem for Linux (WSL) on a Windows system. The steps are compatible with Ubuntu 20.04 or later, commonly used in development environments for UltraLinux-related projects.

Prerequisites

  • Ubuntu 20.04 or later installed (natively or via WSL).

  • Internet connection to download the Anaconda installer.

  • At least 5 GB of free disk space.

  • Basic familiarity with the terminal.

Step-by-Step Installation

1. Download the Anaconda Installer

Visit the official Anaconda download page (https://www.anaconda.com/products/distribution) and locate the Linux installer for the latest version of Anaconda. Alternatively, you can use wget to download the installer directly from the terminal.

Open a terminal and run:

wget https://repo.anaconda.com/archive/Anaconda3-latest-Linux-x86_64.sh

This command downloads the latest Anaconda installer for 64-bit Linux systems. Verify the file name (e.g., Anaconda3-2023.09-0-Linux-x86_64.sh) as it may vary depending on the latest release.

2. Verify the Installer’s Integrity

To ensure the downloaded file is not corrupted, verify its integrity using the SHA256 checksum provided on the Anaconda website. Run:

sha256sum Anaconda3-latest-Linux-x86_64.sh

Compare the output with the checksum listed on the Anaconda download page. If they match, proceed to the next step.

3. Run the Anaconda Installer

Execute the installer script using bash:

bash Anaconda3-latest-Linux-x86_64.sh

Follow the on-screen prompts:

  • Press Enter to review the license agreement.

  • Scroll through the agreement using Enter, then type yes to accept it.

  • Specify the installation directory (default is ~/anaconda3). Press Enter to accept the default or provide a custom path.

  • When prompted to initialize Anaconda by adding it to your shell’s startup scripts (e.g., .bashrc), type yes to enable conda activation automatically.

The installer will extract and install Anaconda, which may take a few minutes.

4. Activate the Anaconda Environment

After installation, activate the Anaconda base environment to verify the installation:

source ~/anaconda3/bin/activate

Your terminal prompt should change to include (base), indicating the Anaconda base environment is active. To check the installed Python version, run:

python --version

This should display the Python version bundled with Anaconda (e.g., Python 3.11.x).

5. Update Anaconda

Ensure Anaconda is up-to-date by running:

conda update -n base conda
conda update anaconda

These commands update the conda package manager and the Anaconda distribution, respectively.

6. (Optional) Create a Virtual Environment

Anaconda allows you to create isolated Python environments for different projects. To create a new environment, run:

conda create -n ultralinux_env python=3.9

Activate the environment:

conda activate ultralinux_env

This environment can be used for UltraLinux-related Python projects, ensuring dependencies are isolated.

7. Test the Installation

To confirm Anaconda is working, try running a simple Python script or launching Jupyter Notebook:

jupyter notebook

This opens Jupyter Notebook in your default browser, allowing you to create and run Python notebooks for testing or development.

8. (Optional) Disable Auto-Activation of the Base Environment

If you prefer not to have the base environment automatically activated when opening a terminal, run:

conda config --set auto_activate_base false

You can manually activate the base environment when needed using conda activate.

Troubleshooting

  • Command not found: conda: Ensure the Anaconda initialization script was added to your .bashrc. If not, run:

    ~/anaconda3/bin/conda init bash

    Then, close and reopen the terminal or source the .bashrc file:

    source ~/.bashrc
  • Insufficient disk space: Verify you have at least 5 GB of free space. Clear space or choose a different installation directory.

  • SPARC-specific considerations: While this guide targets Ubuntu on x86_64 systems, UltraLinux users working on SPARC hardware should ensure compatibility with Anaconda’s x86_64 installer. For SPARC systems, consider using a native Python installation or a containerized solution, as Anaconda does not officially support SPARC.

Conclusion

You now have Anaconda installed on your Ubuntu system, ready for Python development tailored to UltraLinux projects. Anaconda’s comprehensive package management and virtual environment support make it ideal for data science, machine learning, or general Python development. For further assistance, consult the UltraLinux FAQ (https://ultralinux.org/faq.html) or join the UltraLinux mailing lists for community support.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top