Tutorial

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 authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


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!

thank you Lisa for the detailed steps! one suggestion for step 2: it’s better to use wget -c instead of curl over unstable internet connection!

By mistake in step 6 I entered no, installation is done, but when I use condo command it says command not found. Is there any way to resolve this

At the end, if you have problems (conda command not found) or something like that, remember just add conda’s location to your path.

( https://askubuntu.com/questions/908827/variable-path-issue-conda-command-not-found )

Clear, efficient and no problems while following those instructions. enough explications without unnecessary blabla. Thanks a lot

Guys help, please. I successfully installed anaconda (on Ubuntu 18.04), although I didn’t say yes when it asked to be added to path. But I did that manually by editing my bashrc file.

The problem now is when I create an environment and activate it, Conda doesn’t append it to my terminal prompt.
I only know it’s active by doing conda info :)

I created a test_env as such:

conda create -n test_env python=3

Here is the output of conda info:

 active environment : test_env
    active env location : /home/stealthman22/anaconda3/envs/test_env
            shell level : 2
       user config file : /home/stealthman22/.condarc
 populated config files : 
          conda version : 4.8.3
    conda-build version : 3.18.11
         python version : 3.8.3.final.0
       virtual packages : __glibc=2.27
       base environment : /home/stealthman22/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/stealthman22/anaconda3/pkgs
                          /home/stealthman22/.conda/pkgs
       envs directories : /home/stealthman22/anaconda3/envs
                          /home/stealthman22/.conda/envs
               platform : linux-64
             user-agent : conda/4.8.3 requests/2.24.0 CPython/3.8.3 Linux/5.0.0-32-generic linuxmint/19.3 glibc/2.27
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

Hi Lisa, I use Ubuntu 16.04 LTS and after I installed Anaconda the name “(base)” is appearing before my computer’s name in the terminal. Is there a way to take it off without messing with anaconda installation and its packages? Thanks!

Thanks for this, well written article that helped me a lot :)

Thankyou!! Its really a good guide. tunneling concept which I have learnt.

Good Job.

Hi Lisa, It was really a smooth installation following your recommendations, but, like vktud, in Step-6, I automatically put “No” response from the program. Hence I’m not able to activate the conda. What shall I do? Thak you for any help.

Hi Lisa, In Step-6, I am automatically getting “No” response from the program. Hence not able to activate the conda. What shall I do? I am quite new to both ubuntu and Anaconda

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!

Featured on Community

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