REGISTER NOW: DdS Autumn School! 🇨🇭 Grosshöchstetten (Switzerland) 🗓️ 6.-11. October 2024

Environment Management#

How do I save my conda environment for later use?#

Prerequisites

  1. A working installation of Conda

  2. Basic knowledge of the command line shell on your operating system.

  3. Basic knowledge of Conda environments

Perhaps you have already created a Conda environment that you would like to use at a later point (a year after your current LCA project is finished, for example). You can save your environment to a file using the following shell command:

Note

Replace <ENVIRONMENT_NAME> with the name of the environment you want to save.
Replace <FILE_NAME> with the name you want to give the file.
Replace <PATH_TO_FILE> with the path to the file you want to save the environment to.

conda activate <ENVIRONMENT_NAME>
conda env export --from-history > "<PATH_TO_FILE>/<FILE_NAME>.yml"

This will create a file called <FILE_NAME>.yml at the location you specified. The --from-history flag ensures that only those packages are included that you installed into the environment (and not all their dependencies). You can then use this file to recreate the environment at a later point using the following shell command:

Note

Replace <ENVIRONMENT_NAME> with the name of the environment you want to restore.

conda env create -f "<PATH_TO_FILE>/environment.yml"