Report this

What is the reason for this report?

How To Install Anaconda on Ubuntu 18.04 [Quickstart]

Updated on September 30, 2021
English
How To Install Anaconda on Ubuntu 18.04 [Quickstart]

Introduction

Designed for data science and machine learning workflows, 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 Anaconda on an Ubuntu 18.04 server. For a more detailed version of this tutorial, with better explanations of each step, please refer to How To Install the Anaconda Python Distribution on Ubuntu 18.04.

Step 1 — Retrieving the Latest Version of Anaconda

From a web browser, go to the Anaconda Distribution page, available via the following link:

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

Find the latest Linux version and copy the link to the installer bash script.

Step 2 — Downloading the Anaconda Bash Script

Logged into your Ubuntu 18.04 server as a sudo non-root user, move into the /tmp directory and use curl to download the link you copied from the Anaconda website:

  1. cd /tmp
  2. curl -O https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh

Step 3 — Running the Anaconda Script

  1. bash Anaconda3-2019.03-Linux-x86_64.sh

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

Output
Welcome to Anaconda3 2021.05 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>> ... Do you approve the license terms? [yes|no]

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

Step 4 — Completing the Installation Process

Once you agree to the license, you will be prompted to choose the location of the installation. You can press ENTER to accept the default location, or specify a different 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 will proceed. Note that the installation process takes some time.

Step 5 — 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] >>>

It is recommended that you type yes to use the conda command.

Step 6 — Activating Installation

You can now activate the installation with the following command:

  1. source ~/.bashrc

Step 7 — Testing 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 8 — Setting Up Anaconda Environments

You can create Anaconda environments with the conda create command. For example, a Python 3 environment named my_env can be created with the following command:

  1. conda create --name my_env python=3

Activate the new environment like so:

  1. conda activate my_env

Your command prompt prefix will change to reflect that you are in an active Anaconda environment, and you are now ready to begin work on a project.

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 our products

About the author

Lisa Tagliaferri
Lisa Tagliaferri
Author
See author profile

Community and Developer Education expert. Former Senior Manager, Community at DigitalOcean. Focused on topics including Ubuntu 22.04, Ubuntu 20.04, Python, Django, and more.

Still looking for an answer?

Was this helpful?
Creative CommonsThis work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.