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:
-
Open Anaconda Navigator
-
Launch Jupyter Notebook
-
Select New > Terminal
-
Create a conda environment called test_env with python 3.8
conda create -n test_env python=3.8
-
Activate the environment
source activate test_env
-
Install packages to the environment
conda install <packagename>
-
Deactivate the environment
source deactivate
-
Return to the homepage of Jupyter Notebook
-
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:
-
Activate the conda environment you want to create a requirements.txt file for
source activate <envname>
-
Create the requirements.txt file from packages in the conda env
conda list -e > requirements.txt
-
Share requirements.txt file with others
-
Others can then duplicate the conda environment using the requirements.txt file
conda create --name <env> --file requirements.txt