Introduction
Anaconda is a Python-based data science platform. It works on all the most popular operating systems – Windows, Linux, and macOS.
This guide will explain how to install Anaconda on CentOS 8 Linux.
Prerequisites
- A system with CentOS 8 installed
- A user account with sudo or root privileges
- Access to a terminal window
- Minimum 5 GB disk space to download and install
A Note on Python
Python currently has two major releases – Python 3 and Python 2. These versions are not compatible. If you are working on an older project and need Python 2, use that version. For new projects, Python 3 is the recommended option.
Note: If you are unsure which Python version you are using, read our How to Check Python Version article. If you don’t have Python installed, you can refer to our guide on installing Python on CentOS 8.
Installing Anaconda 3 on CentOS 8
This guide will walk you through installing Anaconda 3, which is based on Python 3.7.
Step 1: Download Anaconda
Start by downloading the Anaconda software package. There are two methods available:
- Download Anaconda via GUI
- Download Anaconda using the Linux terminal
Option 1: Download Anaconda via GUI
To download the latest version of Anaconda for CentOS 8, load a browser window and navigate to the Anaconda download page.
Make sure to select Linux as your OS.
Click Download to download Anaconda.
In the example below, we downloaded Anaconda for Python 3.7.
The file should be saved to the Downloads directory. Or you can choose the location.
For this guide, we will use Downloads.
Option 2: Download Anaconda via Linux Terminal
You might need to install Anaconda on a CentOS 8 server without a GUI. If that’s the case, you can always browse to the Anaconda download page on a different system to copy the URL of the download.
Download the installer using the terminal by entering the following:
wget –P ~/Downloads https://repo.anaconda.com/archive/Anaconda3.2020.02-Linux-x86_64.sh
If you need a different version of Anaconda, please refer to the Anaconda archive page. This includes older versions, and versions for different processor architectures.
Step 2: Verify Download Integrity
Next, move in to the Downloads directory (or your custom location):
cd ~/Downloads
Verify the integrity of the file you downloaded:
sha256sum Anaconda3.2020.02-Linux-x86_64.sh
Instead of navigating to the Downloads directory, you can use the full path to the file.
In both cases, the system displays a string of letters and numbers.
Compare that code to the SHA256 hash column value on the Anaconda hashes web page.
If the codes match, that means the software is authentic and ready to be used.
Step 3: Install Anaconda Software Package on CentOS 8
You should have a terminal window open to the ~/Downloads directory. Enter the following command:
bash Anaconda3.2020.02-Linux-x86_64.sh
The system will prompt you to review the license agreement. Press Enter, then use Enter or the Spacebar to scroll through the agreement.
At the end, type yes
to agree to the license.
You’ll be asked to confirm Anaconda’s installation directory. Use the default directory by pressing Enter.
Once the installer finishes, it will prompt you to initialize Anaconda with conda init. This adjusts the PATH variable so that Anaconda works from any directory on your system. Type yes
, then Enter.
Once the installer finishes, it will say Thank you for installing Anaconda3!
Note: You can manually specify a different location for the Anaconda installation. Do not install in the /usr directory. When the installation finishes, this time, you won’t be prompted to initialize Anaconda. Instead, enter the following:
source <anaconda_installation_location>/bin/activate
conda init
Step 4: Verify Anaconda Installation
Restart the terminal window and enter the following command to verify Anaconda installation:
conda info
You can also use this command:
conda list
The system should return a list of all Anaconda files.
You can load the Python programming shell by entering the following:
python
The command prompt should change to three angle-brackets:
>>>
To exit the Python shell, enter the following:
quit()
How to Update Anaconda
Even though you downloaded the most recent version of Anaconda, there may still be patches and updates available.
Start by updating conda:
conda update conda
The system prompts for confirmation. Type y
, then Enter.
Note: Conda is a package manager for the Anaconda Python environment. It’s always best to update your package manager before installing updates.
Once conda is updated, use it to update the Anaconda software:
conda update anaconda
The system prompts for confirmation. Type y, then Enter.
If you want to update to a specific version, enter the following:
conda update anaconda=2020.02
Replace the version number 2020.02 with the actual version you want to update to.
This also works when updating from older versions of Anaconda.
Uninstalling Anaconda
Anaconda has a simple utility to remove the software from your system. Install the removal software by entering the following:
conda install anaconda-clean
The system will prompt you to confirm. Type y
then Enter to confirm.
Once the anaconda-clean software is installed, you can use it to remove Anaconda from your system completely:
anaconda-clean ––yes
The ––yes
option confirms each deletion request. You can omit this option if you want to confirm file deletion manually.
Conclusion
Installing Anaconda on CentOS 8 is a simple and straightforward process. If you followed the steps in this guide, you should now have a working installation of Anaconda on your CentOS 8 system.