In this tutorial we’ll install the latest version of Anaconda Distribution with Python 3.7 on a machine running Ubuntu 18.04. We’ll also show you how to update Anaconda and how to uninstall it from your machine. It is commonly used for scientific computing, predictive analytics and large-scale data processing. Shipping with over 1,400 data science packages, it’s an industry standard for developing, testing, and training on a single machine.

Anaconda is a very popular open-source package manager, environment manager and distribution of Python and R. It’s the most popular data science and machine learning platform

Step 1 – Download the Anaconda Install Script

We’ll install Anaconda via the bash installation script made available on the Anaconda website.

To locate the script for the latest version of Anaconda, visit the Anaconda Downloads Page and retrieve the first download link – either from the big Download button or the link under it, corresponding to your preferred Python version.

download_anaconda_latest_version

NOTE: As you can see, at the time of writing, the latest version is Anaconda 2018.12. Do keep this in mind if you intend on copy pasting the following commands.

To keep things clean, let’s change our directory to /tmp and download the script there. In our example, I’ll be downloading Anaconda 2018.12 with Python 3.7.

Step 2 – Verify the Installer Script’s Integrity

Once the script has been downloaded, it’s recommended that we check the file’s integrity by verifying the script’s hash via the sha256sum command, after which we’ll check the hash that the command returns against the hash shown on the Anaconda website. Just follow these steps:

While still in the /tmp directory, run the sha256sum command to verify your script’s checksum. In my case, when checking the latest version at the time of writing, the command looks like this:

The following is my output:

Now it’s time to check against the hash shown in the Anaconda Docs, under hashes for Python 3, for my version.

To do this, visit the Anaconda with Python 3 on 64-bit Linux page, and find the version you’ve downloaded.

latest_anaconda_python_3_x64

In my case, the latest version is Anaconda3-2018.12-Linux-x86_64.sh.

When you’ve located the link to the Hashes Page for your version, click it and you’ll be presented with some data regarding the script you downloaded, among which is the script’s sha256.

verify_anaconda_sha256

The hash displayed matches the hash in the command-line output, when I ran the sha256sum command, so I can confirm the integrity of the Anaconda installer that I’ve downloaded and proceed with the installation.

Step 3 – Run the Anaconda Installer Script

To start the Anaconda install process, run the installer script:

The initial output will ask you to review the license agreement. You can press ENTER to read through the agreement.

At the end of the agreement, you’ll reach a prompt asking you to type yes or no with regards to accepting the license terms.

If you type yes, you’ll then be informed where the Anaconda default install location is, and if you’d like to change it:

If you’d like to install it in the default location just press enter and the install process will commence.

The installation may take a while, depending on your machine and internet connection, as Anaconda comes with over 1400 packages.

After the packages are installed, you’ll be presented with the following prompt.

If you want to use the conda command, then type yes and press enter.

You’ll be then presented by another prompt confirming the installation of Anaconda on your Ubuntu machine, and another one asking if you’d like to install VSCode.

Anaconda is not dependent on Visual Studio Code. You can choose depending on your preference. To find out more about VSCode, you can check out their website.

[Example] Running the Anaconda Installer Script

The enable the conda command, run the following command to load the new PATH environment variable that Anaconda just added earlier:

Step 4 – Verify the Anaconda Installation

To verify that Anaconda, you can use the conda command, and the output will display information on the current conda install:

The output will look something like this:

That’s it, you have now successfully installed Anaconda on your Ubuntu 18.04 machine.

Updating Anaconda

When you want to update Anaconda you just have to run two commands:

  1. First update the conda tool:

    You’ll be prompted to confirm you want the update. If you wish to go through with it, then type y and ENTER to confirm.

  2. Once conda is updated, use the command to update Anaconda:

    When prompted to confirm, type y and ENTER to confirm the update.

Uninstalling Anaconda

To uninstall Anaconda from your Ubuntu 18.04 machine, follow these steps:

  1. Remove the entire Anaconda installation directory. The command may very, depending where you chose to install it.

  2. Remove the contents added by Anaconda to ~/.bashrc:

  3. Remove Anaconda related hidden files and folders in your home directory:

Conclusion

Well done. You’ve successfully installed Anaconda on your Ubuntu 18.04 and also learned how to update or uninstall it. You can now hopefully work on your data science projects.

If you’ve encountered any issues when following this tutorial, feel free to get in touch with us via the comment section or by contacting us on email or our social channels.


Vlad

Tech Support

Leave a Comment

LIMITED TIME SPECIAL 💀

Enter your email below to get 20% OFF on any of our Linux VPS plans and receive weekly deals on our services!