Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Linux Last updated: June 19, 2023
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Anaconda is a Python distribution used for machine learning, data science, and integrated development environment. However, its offerings are not limited to Python.

It supports open-source libraries such as TensorFlow, PyTorch, SciPy, scikit-learn, etc., which are used for data science and machine learning.

Let’s walk through some open-source tools supported by Anaconda and used for scientific computing:

  • OpenCV – It is a computer vision and machine learning library for C++, Java, and Python with support for all major operating systems.
  • Tensorflow – An end-to-end machine learning platform for training ML models having APIs for Java, C++, Javascript, and Python.
  • Bokeh – It is a data visualization library for web browsers providing tools and widgets to better visualize the specifics of your data.
  • Spyder – An IDE that comes bundled with Anaconda providing a complete development ecosystem for data scientists and machine learning folks.
  • Conda – It also provides a package manager named conda, which is used to manage and install packages for various programming languages such as Python, R, and Julia. Python, if installed independently, contains a package manager named pip, which is an alternative to conda. The pip package manager downloads packages from the Python package index — it’s like npm but for Python.

Use cases for Anaconda

https://youtu.be/ErIaJFNECCs

What makes Anaconda rich is its support for a variety of packages that can be used for the following domains:

Image Processing

With support for libraries such as OpenCV and scikit-image, anaconda proves to be an efficient package for image processing and computer vision projects. Image manipulation, analysis, processing, cleaning, restoration, and much more can be done using these open-source libraries.

Data Analysis

Anaconda’s robust ecosystem of libraries and tools can be used for data manipulation, preprocessing, and providing useful insights into data.

Libraries such as Pandas and Numpy make it possible for data scientists to analyze, clean, and manipulate data in a structured and controlled manner.

Data Visualization

An Anaconda project named Holoviz is a Python-based data visualization tool that includes Panel, hvPlot, Datashader, and a lot more Python packages to make data visualization more powerful and accurate.

Data visualization is really helpful for visually communicating ideas and concepts through data. Effective visualizations help in improved decision-making by communicating patterns in the data.

Machine Learning

Tensorflow, Pytorch, and scikit-learn are libraries offered by Anaconda for machine learning-related projects.

Natural Language Processing

For NLP academics and developers, Anaconda offers a suitable environment for experimenting with various algorithms and strategies. NLP libraries supported by Anaconda are NTLK, gensim and spaCy.

So, to summarize, Anaconda is a bundle or a distribution containing tools and libraries which are useful in data science and machine learning.

With that being said, let’s look at Anaconda’s installation process.

Installing Anaconda

Installing-Anaconda

Prerequisites

Minimum 5 GB of disk space

Anaconda can be installed by downloading an installer which is technically a bash script, verifying the hash, and running it.

#1. Downloading the script

You can download the installer from Anaconda’s official website and execute it. However, if you want to download an older release, you can do that by using ‘curl’. You can find bash scripts for all Anaconda releases here.

curl https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh

#2. Verifying the sha256 hash

Once that’s done, you must verify the hash of the file against the hash listed here. Verifying the hash is really important in order to make sure the file hasn’t been tampered with and to prevent malicious script execution on your system.

To do so, you need the filename of the bash script. You can get the filename of the script using the ls command.

ubuntu ls command

Get the hash by using the following command:

sha256sum your_bash_script_filename
anaconda_sha256_hash

Verify the hash you received with the hash listed on Anaconda’s website for your particular installation type. If they match, you are good to go!

#3. Executing the bash script

Next, run the bash script using the following command:

bash bash_script_name.sh

Then, you will be prompted to agree to their licenses and agreement. Enter “yes” to proceed. After that, it will ask you to verify the location of the installation.

ubuntu_anaconda_location

The installation will now begin. Once it is successful, you will receive a message to initialize anaconda using conda init. Type “yes” if you want to do so.

#4. Activating Anaconda

If you wish to activate the anaconda later sometime, you can use the following command:

source <conda installation path>/bin/activate
ubuntu_anaconda_activate

And then run, conda init. You need to restart your terminal after that.

#5. Adding PATH to anaconda installation

Also, add the path to your Anaconda installation manually if you opted for not initializing conda at the time of installation. You can do so by adding the following line in your ~/.bashrc file. Just replace <anaconda installation path> with the actual installation path.

export PATH=<anaconda installation path>/bin:$PATH

That’s it; you have successfully installed Anaconda on Ubuntu! You can verify the installation using the following steps.

#6. Verifying installation

Restart your terminal and type conda list. This command will list all the packages which are currently installed on your system.

conda list
ubuntu_anaconda_list

Or else, you can verify the version of Python installed by Anaconda.

python --version

Setting Up Environments

Environments in Anaconda are a great way to isolate different installations of Python and other packages specifically required for a particular project. Each environment is like an isolated box that has its own version of Python and a set of relevant packages.

#1. Creating Environments

When you activate Anaconda for the first time, you are in the base environment which is indicated by the (base) keyword right before your terminal path.

In order to create a new environment, use the following command and just replace the <<env_name>> with the name with which you want this environment to be recognized:

conda create --name <<env_name>>

You will see the following output at the time of the environment creation process.

ubuntu_anaconda_creating_env

In order to use a specific environment, you need to run conda activate <<env_name>> with <<env_name> being the name of the environment.

geekflare_ubuntu_anaconda_activate_environment

You should see the name of the environment right before the terminal path.

#2. Creating environments with packages

At the time of environment creation, you can also specify the Python version which will be used inside that environment.

conda create --name <<env_name>> python=<<python_version>>

If you want to use the latest version of Python, then just do:

conda create --name <<env_name>> python
ubuntu_anaconda_activate_environment_py

#3. Listing all environments

In order to list all environments, specify the following command in the terminal:

conda env list
ubuntu_anaconda_env_list

Final Words

Anaconda has proved to be beneficial for scientific computing because it provides environmental management, pre-installed packages, and a complete developer-friendly ecosystem.

Data scientists and researchers benefit from it by only focusing on data analysis and research instead of worrying about software technicalities.

Want to break into a data science and machine learning career? Here are resources for Data Science and Machine Learning which will help you to start your journey.

  • Murtuza Surti
    Author
    Software Engineer & Content Creator
Thanks to our Sponsors
More great readings on Linux
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Monday.com is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder