How do I save my conda environment for later use?#
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:
<ENVIRONMENT_NAME> with the name of the environment you want to save.
<FILE_NAME> with the name you want to give the file.
<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:
<ENVIRONMENT_NAME> with the name of the environment you want to restore.
conda env create -f "<PATH_TO_FILE>/environment.yml"