How to Install Anaconda on CentOS 8?


Anaconda is a widely used distribution of Python and R programming languages. It provides a comprehensive set of tools for data science, machine learning, and scientific computing. Installing Anaconda on CentOS 8 is a straightforward process that can be accomplished in a few simple steps.

In this article, we will guide you through process of installing Anaconda on CentOS 8.

Step 1: Download Anaconda Installation Script

The first step is to download Anaconda installation script from official Anaconda website. To do this, open a web browser and navigate to https://www.anaconda.com/products/distribution. Click on "Download" button under Anaconda distribution for Linux.

After download is complete, navigate to directory where script was downloaded.

Step 2: Run Anaconda Installation Script

Once you have downloaded Anaconda installation script, next step is to run it. Open a terminal window and navigate to directory where script was downloaded.

To run script, enter following command −

bash Anaconda3-2021.05-Linux-x86_64.sh

Note that name of script may be different, depending on version of Anaconda you downloaded.

You will be prompted to accept license agreement. Press Enter to scroll through license agreement, and then type "yes" to accept license.

Next, you will be prompted to choose installation location. default location is usually fine, but you can choose a different location if you prefer.

Finally, you will be asked if you want to add Anaconda to your PATH environment variable. This allows you to access Anaconda from any directory in terminal. We recommend selecting "yes" to add Anaconda to your PATH.

Step 3: Verify Anaconda Installation

After installation is complete, you can verify that Anaconda is installed correctly by opening a new terminal window and entering following command −

conda --version

If Anaconda is installed correctly, you should see version number of installed Anaconda distribution.

Step 4: Update Anaconda

It is a good practice to update Anaconda after installation to ensure that you have latest version of software. To update Anaconda, open a terminal window and enter following command −

conda update --all

This command updates all packages installed in Anaconda distribution.

Step 5: Create a New Conda Environment

Anaconda allows you to create multiple isolated environments, each with its own set of packages and dependencies. To create a new conda environment, open a terminal window and enter following command −

conda create --name myenv

This command creates a new environment named "myenv." You can replace "myenv" with any name you like.

Step 6: Activate Conda Environment

Once you have created a new conda environment, you need to activate it to start using it. To activate environment, enter following command −

conda activate myenv

Replace "myenv" with name of environment you created in Step 5.

Step 7: Install Packages in Conda Environment

Now that you have activated new conda environment, you can install packages and dependencies specific to that environment. To install a package, enter following command −

conda install package-name

Replace "package-name" with name of package you want to install.

Step 8: Deactivate Conda Environment

When you are finished working in conda environment, you can deactivate it by entering following command −

conda deactivate

This returns you to base environment, where you can create new conda environments or work on other projects.

Additionally, Anaconda also provides an easy-to-use graphical user interface (GUI) called Anaconda Navigator, which allows you to manage environments, install packages, launch Jupyter notebooks, and access documentation and tutorials.

To launch Anaconda Navigator, open a terminal window and enter following command −

anaconda-navigator

This will open Navigator application, where you can access all tools and features of Anaconda.

Another important feature of Anaconda is its integration with popular development environments such as Jupyter Notebook, JupyterLab, and Spyder. These environments allow you to write and execute code interactively, making it easy to explore data, visualize results, and share your work with others.

Jupyter Notebook, for example, provides a web-based interface that allows you to create and share documents containing live code, equations, visualizations, and narrative text. You can run Jupyter Notebook from within Anaconda by launching it from Navigator or by entering following command in a terminal window −

jupyter notebook

This will open a new tab in your web browser with Jupyter Notebook interface, where you can create and edit notebooks, execute code, and view results.

Spyder, on other hand, is an integrated development environment (IDE) that provides a powerful editor, a debugger, and a variable explorer. You can launch Spyder from Anaconda Navigator or by entering following command in a terminal window −

spyder

This will open Spyder IDE, where you can write and execute Python code, debug your programs, and explore variables.

Anaconda also provides a package management system that allows you to install, update, and remove packages and dependencies. package management system is based on conda package manager, which is included in Anaconda distribution. With conda, you can easily install packages from a central repository, create isolated environments, and manage dependencies.

To install a package using conda, simply enter following command in a terminal window −

conda install package-name

Replace "package-name" with name of package you want to install. Conda will automatically download and install package and its dependencies.

If you need to update a package, you can use following command −

conda update package-name

This will update package to latest version available in conda repository.

If you want to remove a package, you can use following command −

conda remove package-name

This will remove package and its dependencies from environment.

Overall, package management system provided by Anaconda makes it easy to manage packages and dependencies, ensuring that you have right packages installed for your project.

In addition to package management system, Anaconda also provides a wide range of packages and libraries for data science, machine learning, and scientific computing. These packages include popular libraries such as NumPy, Pandas, Matplotlib, Scikit-learn, and TensorFlow, among many others.

Anaconda also provides support for virtual environments, which allow you to create isolated environments for your projects. Virtual environments are particularly useful when you are working on multiple projects that require different versions of packages or dependencies.

To create a virtual environment using Anaconda, you can use following command −

conda create --name env-name

Replace "env-name" with name of your virtual environment. You can then activate virtual environment by using following command −

conda activate env-name

Once you have activated your virtual environment, you can install required packages and dependencies using package management system provided by Anaconda. You can also install packages specific to your virtual environment, without affecting other environments or base Anaconda distribution.

Overall, support for virtual environments provided by Anaconda makes it easy to manage dependencies and packages across multiple projects, ensuring that each project has required packages and dependencies without conflicts.

Finally, Anaconda also provides support for cloud-based computing, which allows you to run your data science or machine learning projects on cloud platforms such as Amazon Web Services, Microsoft Azure, or Google Cloud Platform. By using cloud-based computing, you can easily scale your projects, share your work with others, and access powerful computing resources without having to manage infrastructure or hardware.

Conclusion

Installing Anaconda on CentOS 8 is a straightforward process that can be accomplished in a few simple steps. By following steps outlined in this article, you can quickly install Anaconda and start working with tools and packages provided by distribution.

One of great advantages of Anaconda is ability to create isolated conda environments, each with its own set of packages and dependencies. This allows you to work on multiple projects simultaneously without worrying about package conflicts or compatibility issues.

Finally, remember to keep Anaconda up to date by regularly updating distribution and its packages. By doing so, you will ensure that you have access to latest features and bug fixes.

Updated on: 12-May-2023

919 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements