5

To save a conda environment and re-create it, I use:

# Save the environment
conda env export > my_conda_env.yml

# Re-create the environment
conda env create --file my_conda_env.yml

# Reactivate the environment
conda activate pytorch 

I notice that my_conda_env.yml contains prefix: /home/franck/anaconda3/envs/pytorch on the last line. What's the point of it?

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501

1 Answers1

3

It specifies the directory to put the environment in.

Straight from the documentation:

You can control where a conda environment lives by providing a path to a target directory when creating the environment. For example, the following command will create a new environment in a subdirectory of the current working directory called envs:

conda create --prefix ./envs jupyterlab=0.35 matplotlib=3.1 numpy=1.16

Or, you could have checked:

conda env create --help

And it shows:

  -p PATH, --prefix PATH
                        Full path to environment location (i.e. prefix).
juanpa.arrivillaga
  • 88,713
  • 10
  • 131
  • 172