How to Install Anaconda on CentOS 7

How to Install Anaconda on CentOS 7
How to Install Anaconda on CentOS 7

Install Anaconda on CentOS 7

Anaconda is the opensource package manager and distribution of Python and R Programming language. Anaconda is mainly designed for Data Science and Machine Learning and used for large-scale data processing, predictive analysis, and scientific computing. It offers over 1400 data packages in the free and paid form. It also ships with conda command line utility. This tutorial outlines how to install Anaconda on CentOS 7.

Prerequisites

Before you start to install Anaconda on CentOS 7. You must have the non-root user account on your system with sudo privileges.

Install Anaconda

The current latest stable version for Anaconda is 2018.12 at the time of writing this tutorial. You can check if the new version is available by visiting Anaconda Download Page.

First, navigate to /tmp directory using following command:

cd /tmp

Download Anaconda installation script with curl typing:

curl -O https://repo.continuum.io/archive/Anaconda3-2018.12-Linux-x86_64.sh

Check data integrity of the script by running sha256sum command.

sha256sum Anaconda3-2018.12-Linux-x86_64.sh

The output should be like:

09f53738b0cd3bb96f5b1bac488e5528df9906be2480fe61df40e0e0d19e3d48  Anaconda3-2018.12.0-Linux-x86_64.sh

Make it sure above hash matches with hash available at Anaconda with Python 3 on 64 bit Linux page

Now start anaconda installation script running following command.

bash Anaconda3-2018.12.0-Linux-x86_64.sh

The output should be like:

Welcome to Anaconda3 2018.12

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue

Now press ENTER to continue. Again press ENTER to scroll through the license of Anaconda. At last, you will be asked to accept the license terms.

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

Type yes to continue. Then you will be asked to choose the installation directory.

Anaconda3 will now be installed into this location:
/home/linux4one/anaconda3

    - Press ENTER to confirm the location
    - Press CTRL-C to abort the installation
    - Or specify a different location below

You can press ENTER to accept default location or you specify another location.

After completing installation following output will be dispalyed:

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

You want to use command line utility conda then press ENTER after this you will get output like below:

Appending source /home/linux4one/anaconda3/bin/activate to /home/linux4one/.bashrc
A backup will be made to: /home/linux4one/.bashrc-anaconda3.bak

For this change to become active, you have to open a new terminal.

Thank you for installing Anaconda3!

You will be also asked to install VSCode Editor (Visual Studio Code). Now decide whether to install or not by typing yes or no.

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: https://code.visualstudio.com/license

Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]

Source the ~/.bashrc file to activate Anaconda:

source ~/.bashrc

Now verify the installation typing following command.

conda info

The output should be like:

    active environment : None
    user config file : /home/linuxize/.condarc
populated config files :
        conda version : 4.5.4
    conda-build version : 3.10.5
        python version : 3.6.5.final.0
    base environment : /home/linuxize/anaconda3  (writable)
        channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                        https://repo.anaconda.com/pkgs/main/noarch
                        https://repo.anaconda.com/pkgs/free/linux-64
                        https://repo.anaconda.com/pkgs/free/noarch
                        https://repo.anaconda.com/pkgs/r/linux-64
                        https://repo.anaconda.com/pkgs/r/noarch
                        https://repo.anaconda.com/pkgs/pro/linux-64
                        https://repo.anaconda.com/pkgs/pro/noarch
        package cache : /home/linuxize/anaconda3/pkgs
                        /home/linuxize/.conda/pkgs
    envs directories : /home/linuxize/anaconda3/envs
                        /home/linuxize/.conda/envs
            platform : linux-64
            user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/4.15.0-22-generic ubuntu/18.04 glibc/2.27
                UID:GID : 1000:1000
            netrc file : None
        offline mode : False

Update Anaconda

Regularly update Anaconda to latest version by using the following commands.

Always update conda command line utility first running following command:

conda update conda

Confirm update by typing y.
Now update Anaconda typing following command.

conda update anaconda

Here also confirm update by typing y.

NOTE: Always regularly update Anaconda to latest version

Uninstall Anaconda

To uninstall anaconda you should run following commands.

First, remove the entire anaconda installation directory by using the following command.

rm -rf ~/anaconda3

Now edit ~/.bashrc file.

sudo nano ~/.bashrc

Remove following line from the above file.

# added by Anaconda3 installer
export PATH="/home/linux4one/anaconda3/bin:$PATH"

Finally, run following command to remove hidden files and folders created during installation.

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

Conclusion

You have successfully learned how to install Anaconda on CentOS 7. If you have any queries regarding this then please don’t forget to comment below.