Anaconda

Anaconda is a distribution method of Python and R that aims to simplify package management and deployment. It is a data science toolkit that is equipped with thousands of open-source packages and libraries.

How to Install Anaconda

For windows users, navigate to docs.anaconda.com/anaconda/install/windows/

For mac users, navigate to docs.anaconda.com/anaconda/install/mac-os/

Anaconda Environments

Anaconda supports many versions of R and Python along with many packages. Most commonly, an Anaconda Environment is a development environment created with one version of R or Python and a group of packages needed for the project. This creates a custom environment that can creates consistency between project members and project applications.

To create a conda environment, follow these steps:

  1. Open Anaconda Navigator

  2. Launch Jupyter Notebook

  3. Select New > Terminal

  4. Create a conda environment called test_env with python 3.8

    conda create -n test_env python=3.8
  5. Activate the environment

    source activate test_env
  6. Install packages to the environment

    conda install <packagename>
  7. Deactivate the environment

    source deactivate
  8. Return to the homepage of Jupyter Notebook

  9. Click New and the new conda envirnonment will be available to use for development

Sharing Conda Environments

One of the main advantages of using conda environments is that environment specifications be shared between team members to keep consistency between the development environment of a project and its associated applications.

To create a requirements.txt file from a conda environment, follow these steps:

  1. Activate the conda environment you want to create a requirements.txt file for

    source activate <envname>
  2. Create the requirements.txt file from packages in the conda env

    conda list -e > requirements.txt
  3. Share requirements.txt file with others

  4. Others can then duplicate the conda environment using the requirements.txt file

    conda create --name <env> --file requirements.txt