Key reference: Conda docs on environment management
Lately, I have been tinkering some codes on three systems: my local MacOS, DigitalOcean droplet (ubuntu), and AWS ec2 (ubuntu with gpu supports). MacOS was for ground0 development and testing with ultra lightweight data load; DO Droplet for a set of time-consuming data processing, and AWS for preliminary model training. Although Mac and Linux can’t use the same dependency file, sharing environments between DO and AWS are desirable. This is a quick note on how to export dependencies from one platform and cloning it onto another platform.
- Create
environment.yml
file via conda
with your conda environment activated, run the following command to generate dependency yaml file:
conda env export > environment_droplet.yml
2. Commit the yml file, git clone the repo onto the target OS, and create a conda environment from it as follows:
conda env create -f environment.yml
A few other frequently used commands
# list all the conda environment available
conda info --envs # Create new environment named as `envname`
conda create --name envname# Remove environment and its dependencies
conda remove --name envname --all# Clone an existing environment
conda create --name clone_envname --clone envname