Installing Anaconda on Linux

how to install anaconda on linux command line | 2019-10-09 18:36:53

Installing Anaconda on Linux

This section details the installation of the Anaconda distribution of Python on Linux, specifically Ubuntu 18.04, but the instructions should work for other Debian-based Linux distributions as well.

Ubuntu 18.04 comes pre-installed with Python (Version 3.6) and legacy Python (Version 2.7). You can confirm the legacy version of Python is installed by opening up a terminal.

In the terminal type:

$ python

You will most likely see Python Version 2.7 is installed. If you enter:

$ python3

You will most likely see Python Version 3.6 is also installed. You can use the 3.6 Version of Python, but each time a new package needs to be downloaded, the $ pip3 install command must be used.

Install the Anaconda distribution of Python to follow the examples in the book without the need to install additional third-party packages.


  1. Visit

  2. Select Linux

  3. Copy the bash (.sh file) installer link

  4. Use wget to download the bash installer

  5. Run the bash script to install Anaconda3

  6. source the .bash-rc file to add Anaconda to your PATH

  7. Start the Python REPL

1. Visit the Anaconda downloads page

Go to the following link:

2. Select Linux

On the downloads page, select the Linux operating system

3. Copy the bash (.sh file) installer link

In the Python 3.6 Version* box, right-click on the [64-Bit(x86) Installer] link. Select [copy link address].

4. Use wget to download the bash installer

Now that the bash installer (.sh file) link is stored on the clipboard, use wget to download the installer script. In a terminal, cd into the home directory and make a new directory called tmp. cd into tmp and use wget to download the installer. Although the installer is a bash script, it is still quite large and the download will not be immediate (Note the link below includes <release>. the specific release depends on when you download the installer).

$ cd ~
$ mkdir tmp
$ cd tmp

5. Run the bash script to install Anaconda3

With the bash installer script downloaded, run the .sh script to install Anaconda3. Ensure you are in the directory where the installer script downloaded:

$ ls

Run the installer script with bash.

$ bash

Accept the Licence Agreement and allow Anaconda to be added to your PATH. By adding Anaconda to your PATH, the Anaconda distribution of Python will be called when you type $ python in a terminal.

6. source the .bash-rc file to add Anaconda to your PATH

Now that Anaconda3 is installed and Anaconda3 is added to our PATH, source the .bashrc file to load the new PATH environment variable into the current terminal session. Note the .bashrc file is in the home directory. You can see it with $ ls -a.

$ cd ~
$ source .bashrc

7. Start the Python REPL

To verify the installation is complete, open Python from the command line:

$ python

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 18:21:58)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

If you see Python 3.6 from Anaconda listed, your installation is complete. To exit the Python REPL, type:

>>> exit()

Installing on Linux — Anaconda 2.0 documentation


Installation For x86 systems. In your browser, download the Anaconda installer for Linux Optional: Verify data integrity with MD5 or SHA-256 . (For more information on hashes, see cryptographic hash validation Open a terminal and run the following: filename sha256sum filename Replace /path/filename with the actual path and filename of the file you downloaded. Optional: Verify results against the proper hash page to make sure the hashes match. Enter the following to install Anaconda for Python 3.7: Downloads Anaconda3 2019.07 OR Enter the following to install Anaconda for Python 2.7: Downloads Anaconda2 2019.07 Include the command regardless of whether or not you are using Bash shell. If you did not download to your Downloads directory, replace ~/Downloads/ with the path to the file you downloaded. The installer prompts “In order to continue the installation process, please review the license agreement.” Click Enter to view license terms. Scroll to the bottom of the license terms and enter “Yes” to agree. The installer prompts you to click Enter to accept the default install location, CTRL-C to cancel the installation, or specify an alternate installation directory. If you accept the default install location, the installer displays “PREFIX=/home//anaconda<2 or 3>” and continues the installation. It may take a few minutes to complete. We recommend you accept the default install location. Do not choose the path as /usr for the Anaconda/Miniconda installation. The installer prompts “Do you wish the installer to initialize Anaconda3 by running conda init?” We recommend “yes”. If you enter “no”, then conda will not modify your shell scripts at all. In order to initialize after the installation process is done, first run conda>/bin/activate and then run The installer finishes and displays “Thank you for installing Anaconda<2 or 3>!” The installer provides a link to install PyCharm for Anaconda at Close and open your terminal window for the installation to take effect, or you can enter the command ~/.bashrc To control whether or not each shell session has the base environment activated or not, run auto_activate_base . To run conda from anywhere without having the base environment activated by default, use auto_activate_base . This only works if you have run is available in conda versions 4.6.12 and later. After your install is complete, verify it by opening Anaconda Navigator, a program that is included with Anaconda: Open a terminal window and type anaconda-navigator . If Navigator opens, you have successfully installed Anaconda. If not, check that you completed each step above, then see our Help page For more information about Anaconda Navigator, see Navigator After your install completes, start using Anaconda with the instructions in Getting started with Anaconda If you install multiple versions of Anaconda, the system defaults to the most current version as long as you haven’t altered the default install path.

How To Install Anaconda on Ubuntu 18.04 [Quickstart]


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 — Retrieve the Latest Version of Anaconda

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

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

Step 2 — Download 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:

Step 3 — Verify the Data Integrity of the Installer

Ensure the integrity of the installer with cryptographic hash verification through SHA-256 checksum:


Step 4 — Run the Anaconda Script

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

Welcome to Anaconda3 2019.03 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 as long as you agree to the license to complete installation.

Step 5 — Complete 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.

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 6 — Select Options

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

... installation finished. Do you wish the installer to prepend the Anaconda3 install location to PATH in your /home/sammy/.bashrc ? [yes|no] [no] >>>

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

Step 7 — Activate Installation

You can now activate the installation with the following command:

Step 8 — Test Installation

Use the conda command to test the installation and activation:

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

Step 9 — Set 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:

Activate the new environment like so:

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.

Related Tutorials

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

Installing on Linux — conda 4.7.11.post28+0fbd418f documentation

Download the installer: Miniconda installer for Linux Anaconda installer for Linux

In your terminal window, run: Miniconda: Miniconda3 Anaconda: Anaconda

Follow the prompts on the installer screens. If you are unsure about any setting, accept the defaults. You can change them later.

To make the changes take effect, close and then re-open your terminal window.

Test your installation

Open a terminal window.

Open a terminal window.

Remove the entire miniconda install directory with: miniconda

OPTIONAL: Edit ~/.bash_profile to remove the Miniconda directory from your PATH environment variable.

OPTIONAL: Remove the following hidden file and folders that may have been created in the home directory: .condarc directory .continuum directory By running: condarc continuum

How to Install Anaconda on Ubuntu 18.04

Anaconda is the most popular python data science and machine learning platform, used for large-scale data processing, predictive analytics, and scientific computing. Anaconda distribution ships with more than 1,000 data packages, the conda command-line tool and with a desktop graphical user interface called Anaconda Navigator.

This tutorial will guide you through the steps of downloading and installing Anaconda Python Distribution on Ubuntu 18.04.

Installing Anaconda

At the time of writing this article, the latest stable version of Anaconda is version 5.2. Before downloading the Anaconda installer script visit the Anaconda Downloads page and check if there is a new version of Anaconda for Python 3 available for download.

Follow the steps below to install Anaconda on Ubuntu 18.04:

  1. Download the Anaconda Installation Script.

    Change to the tmp directory and download the Anaconda installation script with wget or curl:

    cd /tmp
    curl -O

    The download may take some time depending on your connection speed.

  2. Verify the Data Integrity of the Script.

    Use the sha256sum command to verify the script checksum:


    You should see an output like the following:


    Make sure the hash printed from the command above matches the one available at the Anaconda with Python 3 on 64-bit Linux page for your appropriate Anaconda version.
  3. Run the Anaconda Installation Script

    To start the Anaconda installation process run the installation script:


    You should see an output like the following:

    Welcome to Anaconda3 5.2.0
    In order to continue the installation process, please review the license
    Please, press ENTER to continue

    Press ENTER to continue and then press ENTER to scroll through the license. Once you’re done reviewing the license, you’ll be asked to approve the license terms:

    Do you approve the license terms? [yes|no]

    Type yes to accept the license and you’ll be prompted to choose the installation location.

    Anaconda3 will now be installed into this location:
        - Press ENTER to confirm the location
        - Press CTRL-C to abort the installation
        - Or specify a different location below

    The default location is fine for most users, press ENTER to confirm the location and installation process will continue.

    The installation may take some time and once it is completed, the following output will be displayed:

    Installation finished.
    Do you wish the installer to prepend the Anaconda3 install location
    to PATH in your /home/linuxize/.bashrc ? [yes|no]

    If you want to use the conda command type yes press ENTER and you’ll be presented the following output:

    Appending source /home/linuxize/anaconda3/bin/activate to /home/linuxize/.bashrc
    A backup will be made to: /home/linuxize/.bashrc-anaconda3.bak
    For this change to become active, you have to open a new terminal.
    Thank you for installing Anaconda3!

    The installer will also ask you whether you would like to download and install Visual Studio Code.

    Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined
    code editor with support for development operations like debugging, task
    running and version control.
    To install Visual Studio Code, you will need:
        - Administrator Privileges
        - Internet connectivity
    Visual Studio Code License:
    Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]

    You can find more information about Visual Studio on the editor website. If you want to install Visual Studio Code type yes otherwise type no.

    To activate the Anaconda installation load the new PATH environment variable which was added by the Anaconda installer into the current shell session with the following command:

    source ~/.bashrc
  4. Verify the Installation

    You can verify your Anaconda installation using the conda command. For example to display information about current conda install type:

    conda info

Updating Anaconda

Updating the Anaconda is a pretty straight forward process, first update the conda tool with:

conda update conda

When prompted to confirm the update, type y to proceed.

Once conda is updated, proceed with the Anaconda update:

conda update anaconda

Same as with the previous command, when prompted, type y to proceed.

You should regularly update your Anaconda installation.

Uninstalling Anaconda

If you want to uninstall Anaconda from your Ubuntu system, follow the steps below:

  1. Remove the Anaconda install directory.

    To remove the entire Anaconda installation directory type:

    rm -rf ~/anaconda3
  2. Edit the PATH environment variable.

    Edit the ~/.bashrc file and remove the Anaconda directory from the PATH environment variable:

    # added by Anaconda3 installerexportPATH="/home/linuxize/anaconda3/bin:$PATH"
  3. Remove the hidden files.

    The following rm command will remove the hidden files and folders that have been created in your user home directory:

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


Now that you have downloaded and installed Anaconda your Ubuntu system, you can check the official Getting started with conda guide.

If you hit a problem or have feedback, leave a comment below.