fbpx
 

How to Install Anaconda Python Distribution on Oracle Linux 8

How to Install Anaconda Python Distribution on Oracle Linux 8

Anaconda is a free and open-source package manager of the Python and R programming languages. Anaconda is used to develop software for data science, machine learning, big data processing, scientific computing, and predictive analytics. It is cross-platform and can be installed on several operating systems including Windows, Linux, and macOS. It is very popular among data science professionals as it allows them to install and manage Python dependencies in a single installation easily. It comes with a fantastic collection of scientific Python packages, tools, resources, and IDEs.

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

Prerequisites

  • A server running Oracle Linux 8 on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Download Anaconda Installer Script

First, visit the Anaconda official download page and download the latest version of the Anaconda Python installation script using the following command: https://www.anaconda.com/products/individual

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

Once the Anaconda installer is downloaded, create the sha256 cryptographic hash of the installer file using the command below:

sha256sum Anaconda3-2022.05-Linux-x86_64.sh

You will get the following output:

a7c0afe862f6ea19a596801fc138bde0463abcbce1b753e8d5c474b506a2db2d Anaconda3-2022.05-Linux-x86_64.sh

Next, compare the above result to the hashes available on the Anaconda website.

If the result matches, you can proceed to the next step.

Step 3 – Install Anaconda on Oracle Linux 8

Next, run the Anaconda installer script to install Anaconda on your system.

bash Anaconda3-2022.05-Linux-x86_64.sh

You will be asked to accept the License terms as shown below:

Welcome to Anaconda3 2022.05 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 hit Enter. You will be asked to set the installation location:

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] >>>

Press Enter to proceed with the default location. You will be asked to init Anaconda:

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

Type yes and hit Enter to init Anaconda and finish the installation:

==> 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 is a breeze in DataSpell. It is an IDE designed for exploratory data analysis and ML. Get better data insights with DataSpell. DataSpell for Anaconda is available at: https://www.anaconda.com/dataspell

Now, activate the Anaconda installation using the following command:

source ~/.bashrc

You will get the Anaconda shell in the following output:

(base) [[email protected] ~]#

Step 4 – Verify Anaconda Installation

After the successful installation, you can verify the Anaconda installation using the following command:

conda info

You will get 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.12.0 conda-build version : 3.21.8 python version : 3.9.12.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.12.0 requests/2.27.1 CPython/3.9.12 Linux/4.18.0-348.12.2.el8_5.x86_64 ol/8.5 glibc/2.28 UID:GID : 0:0 netrc file : None offline mode : False

You can see a list of all packages available in Anaconda using the following command:

conda list

You should see all packages in the following output:

# packages in environment at /root/anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py39h06a4308_1 _libgcc_mutex 0.1 main _openmp_mutex 4.5 1_gnu aiohttp 3.8.1 py39h7f8727e_1 aiosignal 1.2.0 pyhd3eb1b0_0 alabaster 0.7.12 pyhd3eb1b0_0 anaconda 2022.05 py39_0 anaconda-client 1.9.0 py39h06a4308_0 anaconda-navigator 2.1.4 py39h06a4308_0

Step 5 – Update Anaconda

Anaconda provides a conda utility to update the Anaconda package. First, run the following command to update the conda utility to the latest version.

conda update conda

You will get the following output:

The following packages will be downloaded: package | build —————————|—————– conda-4.13.0 | py39h06a4308_0 895 KB ———————————————————— Total: 895 KB The following packages will be UPDATED: conda 4.12.0-py39h06a4308_0 –> 4.13.0-py39h06a4308_0 Proceed ([y]/n)? y

Next, update Anaconda with the following command:

conda update anaconda

Step 6 – Create an Environment Using Anaconda

Anaconda provides an easier way to create an environment to organize projects based on Python versions.

To create a new environment named conda_env, run the following command:

conda create –name conda_env python=3

After creating an environment, activate the environment using the following command:

conda activate conda_env

You will get the following shell:

(conda_env) [[email protected] ~]#

Next, verify the Python version using the following command:

python –version

You will get the following output:

Python 3.10.4

To list all your environments, run the following command:

conda info –envs

You should see the following output:

# conda environments: # base /root/anaconda3 conda_env * /root/anaconda3/envs/conda_env

To deactivate from the Anaconda environment, run the following command:

conda deactivate

To remove the conda_env, run the following command:

conda env remove -n conda_env

Sample output:

Remove all packages in environment /root/anaconda3/envs/conda_env:

Step 7 – Uninstall Anaconda

To uninstall Anaconda from your system, you will need to install the anaconda-clean utility on your system. You can install it using the following command:

conda install anaconda-clean

Once installed, you will get the following output:

## Package Plan ## environment location: /root/anaconda3 added / updated specs: – anaconda-clean The following packages will be downloaded: package | build —————————|—————– anaconda-clean-1.1.1 | py39h06a4308_0 8 KB ———————————————————— Total: 8 KB The following NEW packages will be INSTALLED: anaconda-clean pkgs/main/linux-64::anaconda-clean-1.1.1-py39h06a4308_0 Proceed ([y]/n)? y

Next, run the following command to uninstall Anaconda from your system.

anaconda-clean

You will get the following output:

Delete .conda? (y/n): y Backup directory: /root/.anaconda_backup/2022-06-22T114720

Next, remove all files and directories created by Anaconda using the following command:

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

Next, edit the .bashrc file and remove all lines added by Anaconda:

nano ~/.bashrc

Remove the following lines:

# >>> conda initialize >>> # !! Contents within this block are managed by ‘conda init’ !! __conda_setup=”$(‘/root/anaconda3/bin/conda’ ‘shell.bash’ ‘hook’ 2> /dev/null)” if [ $? -eq 0 ]; then eval “$__conda_setup” else if [ -f “/root/anaconda3/etc/profile.d/conda.sh” ]; then . “/root/anaconda3/etc/profile.d/conda.sh” else export PATH=”/root/anaconda3/bin:$PATH” fi fi unset __conda_setup # <<< conda initialize <<<

Save and close the file when you are finished.

Conclusion

In this post, we learned how to install Anaconda on Oracle Linux 8. You also learned how to manage Python using the Anaconda For more information, visit the Anaconda documentation page. Try it on dedicated hosting from Atlantic.Net!

Source

Leave a Reply

Your email address will not be published.

×