Dec 01, 2023
How to Install Anaconda on Ubuntu
Anaconda is a popular Python/R data science platform available for novice users, data scientists, and other scientific communities. The platform is an open-source distribution (distro), meaning users can experiment with Python/R for data science and machine learning on commonly used operating systems like Linux, Windows, and Mac OS X.
In this tutorial, we will provide a step-by-step guide on how to install the latest version of Anaconda on a virtual private server (VPS hosting). We will also cover the process of testing the Anaconda connection and updating the distribution altogether.
What Is Conda, Anaconda, and Miniconda
As an open-source distribution for Python/R, Anaconda can be divided into three main versions – Anaconda and Miniconda are free, and Anaconda Business is a paid version for enterprises. This tutorial will compare only the free versions, as they have everything a beginner data scientist would need.
|For advanced users
|Installation is quick, and lightweight
|Installation is lengthy and takes a lot of space
|Packages need to be installed manually
|Over one thousand packages will be preinstalled
As seen from the table, the full Anaconda version is more suited for beginners because all the required packages are already included. However, keep in mind that having a lot of packages available doesn’t mean you will use them all, not to mention the increased installation time and size. More advanced users go with Miniconda and install only the necessary packages via the Conda package manager.
Conda helps users find and install over 1,500 open-source packages individually from its repository. Conda is extra helpful if you need a different Python version and don’t want to switch between different Anaconda environments. In other words, Conda does all the switching for you.
Want to learn how to manage your packages in Python? Check out our guide to learn how to install Pip on Ubuntu.
How to Install Anaconda on Ubuntu in 3 Steps
The easiest way to install Anaconda on Ubuntu is to use the latest Anaconda installation script.
Important! We are installing the non-GUI version of Anaconda because virtual private servers do not support a graphical user interface.
Start by logging to your VPS via SSH as the root user.
1. Download and Install Anaconda Script
Once you’re logged into your VPS, refresh the APT command to synchronize all repositories via the command line:
sudo apt-get update
Move to the /tmp directory:
Download the newest Anaconda installer with the wget command. If you don’t have it, install it first:
apt-get install wget
Download the Anaconda installer:
Once the download is complete, verify the hash code integrity of the package:
The output will notify if any errors occurred. If there are no errors, move on to the actual installation step. To continue, run the Anaconda bash shell script:
If you want to install Miniconda instead, use the following commands consecutively:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh sha256sum Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh
After running the bash command, you’ll be welcomed to the Anaconda setup. However, you must review and agree to its license agreement before the installation. Hit Enter to continue.
Pressing the space bar a few times will bring you to the end of the license agreement, where you can accept the terms. Type in “yes” as highlighted and hit Enter.
2. Choose Installation Directory
After agreeing to the license terms, the following prompt will ask you to input the directory where to install the Anaconda on the Ubuntu system. The default location is the user’s HOME directory on Ubuntu.
It is recommended to have Anaconda installed in this location. Therefore, press Enter to confirm the default location.
By entering the desired directory manually, you can change the install location to the path you want.
In the next prompt, you will see that the installation process has started. Wait a few minutes until the installer successfully completes the installation process. Type “yes” once more and press Enter.
Congratulations, you have successfully installed Anaconda!
3. Test the Connection
With the installation done, the next step is to activate the added environment settings using the following command:
Then, test out the connection:
If the installation process was successful, a piece of similar-looking information should be displayed:
In case you ever need to update Anaconda, start by updating the conda package manager first:
conda update conda
Then, update the actual Anaconda distribution:
conda update anaconda
Wait a few minutes until the installer successfully completes the Anaconda installation process, type “y” and press Enter.
In order to uninstall Anaconda, install the following anaconda-clean package:
conda install anaconda-clean
Lastly, remove all Anaconda-related files and directories:
Anaconda is a powerful scientific computing distribution used by some of the most prominent organizations in the world. Despite the problematic nature of data sciences, Anaconda makes learning easy with the help of thousands of open-source packages and libraries.
In this tutorial, we’ve compared the different Anaconda versions and covered the installation process for Anaconda and Miniconda on Ubuntu.
We hope this article helped you to install Anaconda on your Ubuntu machine. If you have any questions or suggestions, be sure to leave them in the comments below.
Discover our guide to learn how to list installed packages on Ubuntu.