This document provides a comprehensive guide to saving, sharing, creating, and managing Conda environments effectively.
Conda environments are powerful tools for managing dependencies and ensuring reproducibility in projects. By saving and sharing your environment configurations, you can ensure that others use the exact package versions you used, reducing compatibility issues.
To list all package names and their versions in the current environment, run:
conda env exportThe output displays the name of the environment and all its dependencies. You can save this information to a YAML file:
conda env export > environment.yaml- The
environment.yamlfile will be created (or overwritten) in the current directory. - Share this file via GitHub or other means so others can recreate your environment.
To recreate an environment using an environment.yaml file, use:
conda env create -f environment.yamlThis will create a new environment with the name specified in the environment.yaml file.
If you forget the names of your environments, list them with:
conda env listor:
conda info --envsThe current active environment will have an asterisk (*) next to its name. The default environment is named base.
To view all installed packages in an environment:
- If the environment is not activated:
conda list -n env_name- If the environment is activated:
conda list- To check if a specific package (e.g.,
scipy) is installed:
conda list -n env_name scipyTo delete an environment that is no longer needed, run:
conda env remove -n env_nameReplace env_name with the name of the environment you want to remove.
- Always double-check the name of the environment before deleting.
- Use version control platforms like GitHub to share the
environment.yamlfile for better collaboration.
This guide was developed as part of the Udacity and Accenture initiative to enhance environment management skills.