Anaconda is the most popular machine learning and data science tool used in large scale data processing, predictive analytics, and scientific computing.
The Anaconda distribution comes with over 1,000 data packages, an Anaconda command line tool, and a desktop GUI called Anaconda Navigator.
This tutorial will guide you through the steps to download and install Anaconda Python Distribution on CentOS 7.
Anaconda install
At the time of writing this article, the latest stable release of Anaconda is version 5.3.1. Before downloading the Anaconda installer script, visit the Anaconda downloads page and check if a new version of Anaconda for Python 3 is available for download.
Follow the steps below to install Anaconda on CentOS 7:
- Download the Anaconda installer. Change to directory
tmp
And download the Anaconda installer with the commandwget
orcurl
:cd /tmp curl -O https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh
The download process may take some time depending on your connection speed.
- Check the integrity of the script data. Use commands
sha256sum
To check the checksum text:sha256sum Anaconda3-5.3.1-Linux-x86_64.sh
You will see output like the following:
d4c4256a8f46173b675dd6a62d12f566ed3487f932bab6bb7058f06c124bcc27 Anaconda3-5.3.1-Linux-x86_64.sh09f53738b0cd3bb96f5b1bac488e5528df9906be2480fe61df40e0e0d19e3d48 Anaconda3-5.2.0-Linux-x86_64.sh
Make sure that the hash printed from the above command matches the one in the Anaconda hash on Linux 64-bit page.
https://docs.anaconda.com/anaconda/install/hashes/Anaconda3-5.2.0-Linux-x86_64.sh-hash.html
- Run the Anaconda installer To start the Anaconda installation process, run the installation script:
bash Anaconda3-5.3.1-Linux-x86_64.sh
You will see output like the following:
Welcome to Anaconda3 5.3.1 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue
He presses
ENTER
To continue, pressENTER
to browse licenses. Upon completion of the license review, you will be asked to agree to the terms of the license:Do you approve the license terms? [yes|no]
Writes
yes
to accept the license and you will be asked to select the installation location.Anaconda3 will now be installed into this location: /homeWAYSQUARE/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below
The default location is suitable for most users, press
ENTER
to confirm the location and the installation will continue.The installation may take some time and once completed, the following output will appear
Installation finished. Do you wish the installer to prepend the Anaconda3 install location to PATH in your /homeWAYSQUARE/.bashrc ? [yes|no]
If you want to use command type
conda
Writesyes
and pressENTER
You will see the following output:Appending source /homeWAYSQUARE/anaconda3/bin/activate to /homeWAYSQUARE/.bashrc A backup will be made to: /homeWAYSQUARE/.bashrc-anaconda3.bak For this change to become active, you have to open a new terminal. Thank you for installing Anaconda3!
The installer will also ask you if you want to download and install Visual Studio Code.
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]
You can find more information about Visual Studio on the editor’s website. If you want to install Visual Studio Code. Writes
yes
orno
.To activate the Anaconda installation, download the
PATH
The new environment variable added by the Anaconda installer to the current shell session with the following command:source ~/.bashrc
- Verify installation You can verify that Anaconda is installed using the command
conda
. For example to display information about the current conda installation type:conda info</code
active environment : base active env location : /homeWAYSQUARE/anaconda3 shell level : 1 user config file : /homeWAYSQUARE/.condarc populated config files : conda version : 4.5.11 conda-build version : 3.15.1 python version : 3.7.0.final.0 base environment : /homeWAYSQUARE/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 : /homeWAYSQUARE/anaconda3/pkgs /homeWAYSQUARE/.conda/pkgs envs directories : /homeWAYSQUARE/anaconda3/envs /homeWAYSQUARE/.conda/envs platform : linux-64 user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Linux/3.10.0-957.1.3.el7.x86_64 centos/7 glibc/2.17 UID:GID : 0:0 netrc file : None offline mode : False
Anaconda update
To update Anaconda is a fairly easy process, update the conda tool by:
conda update conda
When asked to confirm the update, type y
to complete.
After updating conda, proceed with Anaconda update process:
conda update anaconda
Just like with the previous command, type when prompted y
to complete.
You should update your Anaconda installation regularly.
How to uninstall Anaconda
If you want to remove Anaconda from your CentOS system, follow these steps:
- Delete the Anaconda installation directory. To remove the entire Anaconda installation directory, use the following command:
rm -rf ~/anaconda3
- Edit the PATH environment variable by editing the file
~/.bashrc
And remove the Anaconda directory from the path of the environment variable:sudo nano ~/.bashrc
# added by Anaconda3 5.3.1 installer # >>> conda init >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$(CONDA_REPORT_ERRORS=false '/homeWAYSQUARE/anaconda3/bin/conda' shell.bash hook 2> /dev/null)" if [ $? -eq 0 ]; then \eval "$__conda_setup" else if [ -f "/homeWAYSQUARE/anaconda3/etc/profile.d/conda.sh" ]; then . "/homeWAYSQUARE/anaconda3/etc/profile.d/conda.sh" CONDA_CHANGEPS1=false conda activate base else \export PATH="/homeWAYSQUARE/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda init <<<
- Delete hidden files. The following command will delete hidden files and folders created in the user’s home directory:
rm -rf ~/.condarc ~/.conda ~/.continuum
conclusion
Now that you have downloaded and installed Anaconda for CentOS, you can check out the official Conda guide.