Cybersecurity Updates & Tools

Install Anaconda on Ubuntu 18.04: Python Data Science Setup Guide

Anaconda is the most widely used Python distribution for data science and machine learning. It bundles Python with over 1,000 scientific packages, including NumPy, pandas, Matplotlib, and scikit-learn, so you can get a full data science environment running without manually installing each dependency. It also includes the conda package and environment manager and Anaconda Navigator, a graphical interface for managing environments and packages.

This guide shows you how to install Anaconda on Ubuntu 18.04.

Prerequisite: You need sudo access.

Install Anaconda on Ubuntu: Download, Verify, and Run the Installer

Before downloading, check the Anaconda Downloads page to see if a newer version is available. If one is, update the filename in the commands below.

Download the installer script to /tmp:

bashcd /tmpcurl -O https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

Verify the checksum. This confirms the file was not corrupted or altered during download:

bashsha256sum Anaconda3-5.2.0-Linux-x86_64.sh

Compare the output hash against the official value listed on the Anaconda hashes page. The strings must match exactly before you proceed.

Run the installation script:

bashbash Anaconda3-5.2.0-Linux-x86_64.sh

Walk through the prompts:

  • Press ENTER to scroll through the license, then type yes to accept it
  • Press ENTER to confirm the default install location (~/anaconda3). This is the right choice for most users
  • When asked whether to initialize Anaconda and add it to PATH in ~/.bashrc, type yes. Without this, you must type the full path to conda each time you use it
  • The installer may offer to install Microsoft VS Code. Type yes or no based on your preference

Activate and Verify Your Anaconda Installation

Load the updated PATH into your current shell session without opening a new terminal:

bashsource ~/.bashrc

Verify the installation:

bashconda info

The output displays the conda version, Python version, active environment, and configured package channels. If it runs without errors, Anaconda is working correctly.

To launch Anaconda Navigator from the terminal, run anaconda-navigator. The graphical interface lets you create isolated environments, install packages, and launch tools like Jupyter Notebook and Spyder directly without using the command line.

Update and Uninstall Anaconda

Updating Anaconda. Update conda first, then the full Anaconda distribution:

bashconda update condaconda update anaconda

Type y when prompted to confirm each update. Run these commands regularly to stay current with the latest package versions and security fixes.

Uninstalling Anaconda. To completely remove Anaconda, follow these steps:

Remove the Anaconda installation directory:

bashrm -rf ~/anaconda3

Open ~/.bashrc and delete the line the installer added. It looks like: export PATH="/home/your_user/anaconda3/bin:$PATH".

Remove the hidden configuration files created during setup:

bashrm -rf ~/.condarc ~/.conda ~/.continuum

The ~/.condarc file holds your conda preferences. The ~/.conda and ~/.continuum directories store package cache and analytics settings. Removing all three leaves your system in a clean state.

Anaconda is now set up on your Ubuntu 18.04 system. Visit the Getting Started with conda guide to learn how to create isolated environments, install packages, and organize your data science projects. Leave a comment below if you run into any issues.