Tutorial

How To Install the Anaconda Python Distribution on Ubuntu 20.04 [Quickstart]

Published on May 19, 2020
English
How To Install the Anaconda Python Distribution on Ubuntu 20.04 [Quickstart]

Introduction

Anaconda is an open-source package manager, environment manager, and distribution of the Python and R programming languages.

This tutorial will guide you through installing the Python 3 version of Anaconda on an Ubuntu 20.04 server. For a more detailed version of this tutorial, with more thorough explanations of each step, please refer to How To Install the Anaconda Python Distribution on Ubuntu 20.04.

Step 1 — Retrieving the Latest Version of Anaconda

From a web browser, find the latest version of Anaconda for Python 3 at the Anaconda Downloads page:

https://www.anaconda.com/distribution/

At the time of writing, the latest version is 2020.02, but you should use a later stable version if it is available.

Step 2 — Downloading the Anaconda Bash Script

Change to the /tmp directory on your Ubuntu 20.04 server as a sudo non-root user.

  1. cd /tmp

Use curl to download the link that you copied from the Anaconda website. We’ll output this to a file called anaconda.sh for quicker use.

  1. curl https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh --output anaconda.sh

Step 3 — Verifying the Data Integrity of the Installer

We can now verify the data integrity of the installer with cryptographic hash verification through the SHA-256 checksum and the script we named anaconda.sh.

  1. sha256sum anaconda.sh
Output
2b9f088b2022edb474915d9f69a803d6449d5fdb4c303041f60ac4aefcc208bb anaconda.sh

You should check the output against the hashes available at the Anaconda with Python 3 on 64-bit Linux page for your appropriate Anaconda version.

Step 4 — Running the Anaconda Script

  1. bash anaconda.sh

You’ll receive the following output to review the license agreement by pressing ENTER until you reach the end.

Output
Welcome to Anaconda3 2020.02 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>>

When you get to the end of the license, type yes as long as you agree to the license to complete installation.

Step 5 — Completing the Installation Process

Choose the location of your installation or press ENTER to accept the default location.

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

At this point, the installation process will continue. Note that it may take some time.

Step 6 — Selecting Options

Once installation is complete, you’ll receive the following output:

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

Type yes so that you can initialize Anaconda3. You’ll receive some output that states changes made in various directories along with a thank you for installing Anaconda.

Step 7 — Activating the Installation

You can now activate the installation by sourcing the ~/.bashrc file:

  1. source ~/.bashrc

Once you have done that, you’ll be placed into the default base programming environment.

Step 8 — Testing the Installation

Use the conda command to test the installation and activation:

  1. conda list

You’ll receive output of all the packages you have available through the Anaconda installation:

Step 9 — Setting Up Anaconda Environments

It’s best practice to create new environments for each of your projects. To create a Python 3 environment called my_env the syntax is as follows:

  1. conda create --name my_env python=3

Press y to verify setup.

You can activate your new environment by typing the following:

  1. conda activate my_env

With your environment activated, your command prompt prefix will reflect that you are no longer in the base environment, but in the new one that you just created.

When you’re ready to deactivate your Anaconda environment, you can do so by typing:

  1. conda deactivate

Here are links to more detailed tutorials that are related to this guide:

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
Leave a comment


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel