Anaconda and Conda (Python Distribution)

Introduction

Anaconda is a distribution of the Python and R programming languages for scientific computing (data science, machine learning applications, large-scale data processing, predictive analytics, etc.), that aims to simplify package management and deployment. The distribution includes data-science packages suitable for Windows, Linux, and macOS. It is developed and maintained by Anaconda, Inc., which was founded by Peter Wang and Travis Oliphant in 2012.

--Wikipedia (2023)

Conda

Conda is a package manager for Python. It is very similar to pip, but it can also be used to manage python itself.

Install Conda

There are various ways to install conda. Here we'll focus on UNIX-like command line installation.

mkdir -p ~/.local/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/.local/miniconda.sh
bash ~/.local/miniconda.sh -b -u -p ~/.local/miniconda3
rm -rf ~/.local/miniconda.sh
~/.local/miniconda3/bin/conda init

Then you'll want to add this path to your PATH environment variable. See BASH or ZSH for more information.

Create a Virtual Environment

You can create a new environment in two ways; via the command line or via a yaml file. Below is how you do it manually with a command line.

conda create --name env python=3.5

This will create a new environment called env. You can also do this via a yaml file.

name: env
dependencies:
- python=3.8
- numpy
- pandas
- matplotlib
- jupyter

Then you can create the environment with the following command.

conda env create -f environment.yml

Activate Conda Environment

To activate a conda environment, use the following command.

conda activate env

Install Packages

To install a package, use the following command.

conda install numpy

You can also install conda forge packages.

conda install -c conda-forge gym=0.18.0

Store Environment in a File

To store the environment in a file, use the following command.

conda env export > environment.yml

References

Web Links

Note Links