Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Install Anaconda on ECS

DZone 's Guide to

How to Install Anaconda on ECS

In this tutorial, we will be installing and setting up Anaconda Python on an Alibaba Cloud Elastic Compute Service (ECS) instance with Ubuntu 16.04 installed.

· Big Data Zone ·
Free Resource

By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Anaconda is an open source and free distribution of Python and R programming languages used for data science and machine learning related applications. Anaconda helps organizations to develop, manage, and automate AI/ML, regardless of the scale of deployment. It allows organizations to scale from individual data scientists to a collaborative group of data scientists, and from a single server to thousands of nodes for model training and deployment.

In this tutorial, we will be installing and setting up Anaconda Python on an Alibaba Cloud Elastic Compute Service (ECS) instance with Ubuntu 16.04 installed.

Prerequisites

  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get $300 - $1200 worth in Alibaba Cloud credits for your new account. If you don't knows about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
  • At least 3GB free disk space is required for installing Anaconda Python.
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS's IP address.
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC.
  • Set up your server's hostname and create user with root privileges.

Setting Up Your Server

Before proceeding with the installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges. Security is hard to determine, however, you would like to use VPN for security enhancement.

# sudo apt update && sudo apt upgrade

One of the best QR code generator to use is QRzebra easy and professional to use to make dynamic QR Codes with logo.

Download and Install Anaconda Python

To download and install Anaconda Python, you are recommended to use Anaconda installer bash script. The bash script will automatically install the required libraries and packages. To do this, you will need to follow the steps below.

Navigate to the /tmp directory, because after installation of Anaconda Python, you will no longer require the Anaconda installer bash script, so you may delete it.

# cd /tmp

To fetch latest version of Anaconda Python installer, you may check official website of Anaconda Python https://www.anaconda.com/download/#linux. Execute the following command to fetch Anaconda Python installer bash script.

# curl -O https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

Execute the following command to check whether the file has been downloaded successfully. Also note the name of the file because it will be used for checksum in the next step.

# ls -li

1

You will need to verify the data integrity of the installation. To do so, you will have to use cryptographic hash verification through SHA-256 checksum. To do this, you will have to execute sha256sum command and use the Anaconda3-5.2.0-Linux-x86_64.sh file name. In your case, the file name may be different due t to the different versions of Anaconda Python.

# sha256sum Anaconda3-5.2.0-Linux-x86_64.sh

You will see the following output:

09f53738b0cd3bb96f5b1bac488e5528df9906be2480fe61df40e0e0d19e3d48  Anaconda3-5.2.0-Linux-x86_64.sh

You can check the out by comparing hashes available at Anaconda Python page. http://docs.continuum.io/anaconda/install/hashes/

You will need to run the following bash script.

# bash Anaconda3-5.2.0-Linux-x86_64.sh

You will be prompted to review the license agreement. Press Enter to continue.

Keep hitting Enter until you see "Please answer 'yes' or 'no'." Type 'yes' and hit Enter.

You will be prompted to confirm installation location. Hit Enter.

You will be prompted to confirm prepend install location to PATH. Type 'yes' and hit Enter.

You will see the following screen. You will be asked to install Microsoft Visual Studio. Type 'yes' and hit Enter to continue.

The installation of Anaconda Python has been completed. In order to activate installation, you will need to source the file using the command below.

# source ~/.bashrc

You can verify the installation by executing the following command.

# conda list

Using for your QR codes a dynamic QR Code generator allows you to track data and edit your content, witch is great if you are a marketer.

Setting Up Anaconda Environments

You can keep projects in Anaconda virtual environments by organizing them on the basis of Python versions and packages. You can specify the version of Python for each Anaconda environment and keep all the related programming files together within that directory. You can check the available versions of Python by executing the command below.

# conda search "^python$"

You will need to create an environment. You can do so by using most recent version of Python 3. You can achieve this by assigning version 3 to Python. To assign version, execute the following command.

# conda create --name aareez python=3

Remember to replace aareez with your desired environment name.

If you want to target a specific version, you may use command by specifying version number as given below.

# conda create --name aareez python=3.7.0

After execution of the above command, you will see the following message where you will be asked for permission to install new packages. Simply type 'y' and hit Enter to proceed.

After successful creation of environment and installation of required packages, you will see a screen suggesting you the command to activate or deactivate created environment.

Each environment on creation installs some required default packages including:

  1. zlib
  2. xz
  3. tk
  4. wheel
  5. setuptools
  6. sqlite
  7. python
  8. readline
  9. openssl
  10. pip

You can also add additional packages if required. For example, if you want to install numpy, you will need to install the following command.

# conda install --name aareez numpy

You will see the following screen which asks you to permit installation of required packages. Type 'y' and hit Enter.

You can activate environment by executing the command below.

# source activate aareez

If you want to install r-acepack in your current environment, you can execute the following command to install r-acepack after activating your environment.

# conda install -c r r-acepack

You will see the following screen which asks you to permit installation of required packages. Type 'y' and hit Enter.

You may deactivate environment using the command below.

# source deactivate

You can verify the version of Python within the environment by using the command below.

# python --version

You can also update the version of conda by executing the command below within the environment.

# conda update python

You can also check the available environments by executing the command below. After executing the command, you will see the list of environments.

# conda info --envs

2

The asterisk (*) indicates the currently activated environment.

If you are willing to install any package during the creation of the environment, you may use the following command for the creation of environment.

# conda create --name aareez python=3 numpy

When you are done working in an environment and no longer require the particular environment to work, you may remove this using the following command.

# conda remove --name aareez ¨Call

You will see the following screen in which you are asked to allow to remove the other installed packages. Type 'y' and hit Enter, environment named aareez will be deleted successfully.

To verify, you can again check the list of available environments by using the following command.

# conda info --envs

3

Update Anaconda

It is necessary to keep your Anaconda up to date to get the latest packages. To do so, you can execute the command below.

# conda update conda

You will be asked for permission to allow updating packages. Type 'y' and hit Enter.

After this execute the following command to update Anaconda.

# conda update Anaconda

This will ensure the use of latest version of Anaconda.

You will be asked for permission to allow updating packages. Type 'y' and hit Enter.

Congratulations! You have successfully installed Anaconda Python on an Alibaba Cloud Elastic Compute Service (ECS) instance.

Topics:
anaconda python environment ,python ,big data ,data science

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}