Atlantic.Net Blog

How to Install Anaconda Python on Rocky Linux 8

Anaconda is a free and open-source package manager for Python. It provides a large variety of packages and is designed for machine learning and data science projects. It can install on all popular operating systems including Windows, Linux, and macOS. Anaconda is used for scientific computing, predictive analytics, and data processing. It provides a conda command-line utility and Anaconda Navigator graphical interface to manage Python packages.

In this post, we will show you how to install Anaconda Python on Rocky Linux 8.

Step 1 – Install Required Dependencies

First, you will need to install some packages required to install Anaconda. You can install all those packages by running the following command:

dnf install libXi libXtst libXrandr libXcursor alsa-lib mesa-libEGL libXcomposite libXScrnSaver libXdamage mesa-libGL -y

Once all the packages are installed, you can move to the next step.

Step 2 – Download Anaconda Installer Script

Next, go to the Anaconda official download page and download the latest version of the Anaconda installer script using the wget command.
Anaconda Download Page

wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh

Once the installer script is downloaded, verify the integrity of the installer file using the following command:

sha256sum Anaconda3-2021.11-Linux-x86_64.sh

This will generate a cryptographic hash as shown below:

fedf9e340039557f7b5e8a8a86affa9d299f5e9820144bd7b92ae9f7ee08ac60  Anaconda3-2021.11-Linux-x86_64.sh

Now check its output against the hashes available at Anaconda installer file hashes for your installer file version as shown below:

Anaconda hashes Page

Step 3 – Install Anaconda

Now, run the downloaded script to install Anaconda on your system.

bash Anaconda3-2021.11-Linux-x86_64.sh

You will be asked to accept the license terms:

Welcome to Anaconda3 2021.11

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

Do you accept the license terms? [yes|no]
[no] >>> yes

Type yes and press the Enter key to start the installation. You should see the following output:

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] >>> 
PREFIX=/root/anaconda3

Preparing transaction: done
Executing transaction: \ 

    Installed package of scikit-learn can be accelerated using scikit-learn-intelex.
    More details are available here: https://intel.github.io/scikit-learn-intelex

    For example:

        $ conda install scikit-learn-intelex
        $ python -m sklearnex my_application.py

    

done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes

Type yes and press the Enter key to initialize Anaconda. You will get the following output:

==> 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!

===========================================================================

Working with Python and Jupyter notebooks is a breeze with PyCharm Pro,
designed to be used with Anaconda. Download now and have the best data
tools at your fingertips.

PyCharm Pro for Anaconda is available at: https://www.anaconda.com/pycharm

Now, run the following command to activate the Anaconda:

source .bashrc

Also Read

How to Install Python 3.10 on Oracle Linux 8

Step 4 – Verify the Anaconda Installation

At this point, Anaconda is installed on your system. You can now verify the Anaconda installation using the following command:

conda info

You should see the following output:

     active environment : base
    active env location : /root/anaconda3
            shell level : 1
       user config file : /root/.condarc
 populated config files : 
          conda version : 4.10.3
    conda-build version : 3.21.5
         python version : 3.9.7.final.0
       virtual packages : __linux=4.18.0=0
                          __glibc=2.28=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /root/anaconda3  (writable)
      conda av data dir : /root/anaconda3/etc/conda
  conda av metadata url : None
           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.10.3 requests/2.26.0 CPython/3.9.7 Linux/4.18.0-348.12.2.el8_5.x86_64 rocky/8.5 glibc/2.28
                UID:GID : 0:0
             netrc file : None
           offline mode : False

You can also list all packages included in the Anaconda repository using the following command:

conda list

You will get a full list of packages in the following output:

# packages in environment at /root/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0            py39h06a4308_0  
_libgcc_mutex             0.1                        main  
_openmp_mutex             4.5                       1_gnu  
alabaster                 0.7.12             pyhd3eb1b0_0  
anaconda                  2021.11                  py39_0  
anaconda-client           1.9.0            py39h06a4308_0  
anaconda-navigator        2.1.1                    py39_0  
anaconda-project          0.10.1             pyhd3eb1b0_0  
anyio                     2.2.0            py39h06a4308_1  
appdirs                   1.4.4              pyhd3eb1b0_0  
argh                      0.26.2           py39h06a4308_0  
argon2-cffi               20.1.0           py39h27cfd23_1  
arrow                     0.13.1           py39h06a4308_0  

Step 5 – Update Anaconda Package

To update the Anaconda package, you will need to update conda first. You can update it with the following command:

conda update conda

You will get the following output:

## Package Plan ##

  environment location: /root/anaconda3

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.11.0               |   py39h06a4308_0        14.4 MB
    ------------------------------------------------------------
                                           Total:        14.4 MB

The following packages will be UPDATED:

  conda                               4.10.3-py39h06a4308_0 --> 4.11.0-py39h06a4308_0


Proceed ([y]/n)? y

Next, install Anaconda using the following command:

conda update anaconda

Step 6 – Uninstall Anaconda

If you want to remove the Anaconda package from your system, you will need to install the Anaconda removal package in your system. You can install it with the following command:

conda install anaconda-clean

You will get the following output:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    anaconda-clean-1.1.0       |   py39h06a4308_1           7 KB
    ------------------------------------------------------------
                                           Total:           7 KB

The following NEW packages will be INSTALLED:

  anaconda-clean     pkgs/main/linux-64::anaconda-clean-1.1.0-py39h06a4308_1


Proceed ([y]/n)? y

Next, run the following command to remove the Anaconda package.

anaconda-clean

You will get the following output:

Delete .conda? (y/n): y
Backup directory: /root/.anaconda_backup/2022-02-16T170117

Next, you will also need to remove the Anaconda directory from the Home directory:

rm -rf ~/anaconda3

Conclusion

In this guide, we explained how to install Anaconda on Rocky Linux 8. We also explained how to update and uninstall Anaconda using the command line. Try it on VPS hosting from Atlantic.Net!

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year