In this tutorial, we will show you how to install Anaconda Python on a Debian 9 VPS.
Anaconda is one of the most popular package managers and distribution systems for the Python and R programming languages. It is open-source and designed for data science and machine learning platforms, and is used for large-scale data processing, deep learning-related applications, and scientific computing.
Anaconda Distribution is used by over 15 million users and it offers more than 1400 data packages individually from its repository. Anaconda python also includes an environment manager and a package manager called ‘conda’. It works on all major operating systems, including Linux, macOS, and Windows.
Let’s begin with the installation.
Table of Contents
- For the purposes of this tutorial, we will use a Debian 9 VPS.
- Full SSH root access or a user with sudo privileges is also required.
Step 1: Connect via SSH and Update the OS
Connect to your server via SSH as the root user using the following command:
ssh root@IP_ADDRESS -p PORT_NUMBER
Remember to replace “IP_ADDRESS” and “PORT_NUMBER” with your server’s respective IP address and SSH port number.
Before starting with the installation, you will need to update your OS packages to their latest versions. It’s easy to do, and it won’t take more than a few minutes.
You can do this by running the following command:
apt-get update apt-get upgrade
Once the updates are completed, we can move on to the next step.
Step 2: Install Anaconda
The current latest stable version for Anaconda is 2019.07 at the time of writing this tutorial. You can check if the new version is available by visiting the Anaconda download page at the Anaconda website.
Change to the
/opt directory and download the Anaconda installation script with the following command:
cd /opt wget https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
Once the script is downloaded, use the
sha256sum command to verify the script checksum as shown below:
The output will look similar to bellow:
Make it sure above hash matches with hash available at the “Anaconda with Python 3 on 64 bit Linux” webpage: https://docs.anaconda.com/anaconda/install/hashes/Anaconda3-2019.07-Linux-x86_64.sh-hash/
If the hashes match, you can continue with the Anaconda Python installation.
To start the Anaconda installation process run the installation script:
You should see an output like the following:
Welcome to Anaconda3 2019.07 In order to continue the installation process, please review the license agreement. 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 accept the license terms:
Do you accept the license terms? [yes|no] [no] >>> Please answer 'yes' or 'no':' >>> yes
Type yes and hit ENTER, and you will be prompted to accept the default Anaconda installation path:
Anaconda3 will now be installed into this location: /root/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/root/anaconda3] >>>
Press ENTER to confirm the default location
/root/anaconda3 and the Anaconda installation will start, which may take some time, depending on your server resources. And once it is completed, the following output will be displayed:
installation finished. Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no] [no] >>> yes
We will type “yes” so that we can use the
conda command. You will get an output similar to the one below:
==> For changes to take effect, close and re-open your current shell. <== If you'd prefer that conda's base environment not be activated on startup, set the auto_activate_base parameter to false:
conda config --set auto_activate_base false Thank you for installing Anaconda3! =========================================================================== Anaconda and JetBrains are working together to bring you Anaconda-powered environments tightly integrated in the PyCharm IDE. PyCharm for Anaconda is available at: https://www.anaconda.com/pycharm
Next, source the
~/.bashrc file to activate your Anaconda installation with the following command:
We can now verify our Anaconda installation by running the following command:
The output below shows the conda version:
We can also verify the basic Anaconda installation information using the following command:
The output should look like this:
active environment : base active env location : /root/anaconda3 shell level : 1 user config file : /root/.condarc populated config files : conda version : 4.7.10 conda-build version : 3.18.8 python version : 3.7.3.final.0 virtual packages : base environment : /root/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 : /root/anaconda3/pkgs /root/.conda/pkgs envs directories : /root/anaconda3/envs /root/.conda/envs platform : linux-64 user-agent : conda/4.7.10 requests/2.22.0 CPython/3.7.3 Linux/4.9.0-5-amd64 debian/9.3 glibc/2.24 UID:GID : 0:0 netrc file : None offline mode : False
Step 3: Upgrade Anaconda
You need to regularly update Anaconda to the latest version. In order to upgrade Anaconda, we need to upgrade the conda tool with the following command:
conda update conda
We will be asked to accept the update, so we have to type “y” and hit ENTER to update conda. Once the conda utility is updated, we can proceed with Anaconda update by running the following command:
conda update anaconda
We will be asked to accept the update, so type “y” and hit ENTER to update Anaconda.
Step 4: Set Up an Anaconda Environment
Anaconda virtual environments is a working copy of Python that maintains its own files, directories, and paths so that we can work with specific versions of libraries or Python.
For example, to create a Python 3 environment named
new_env, run the following command:
conda create --name new_env python=3
Once created, activate the new environment with the following command:
conda activate new_env
Once activated, we are now ready to begin work on a project.
Congratulations. We have successfully installed Anaconda Python on our Debian 9 VPS. For more information about Anaconda Python, visit the official documentation page at Anaconda website.
Of course, you don’t have to install Anaconda Python on Debian 9 if you use one of our Python VPS Hosting solutions, in which case you can simply ask our expert Linux admins to install Anaconda Python on Debian 9 for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post on how to install Anaconda Python on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.