Shubham Pandey
Shubham Pandey

Reputation: 1019

How to create a Conda environment based on a YAML file?

I am working on a online course and the instructors have asked me to create a Conda environment, and they have provided a YAML file to provide the library and package requirements for the Conda package.

However, I am unable to find a way to create the environment using the YAML file.

Upvotes: 49

Views: 78314

Answers (3)

ws_e_c421
ws_e_c421

Reputation: 1113

Use:

conda env create --name NAME --file FILE

where FILE is the YAML file and NAME is what you want to name the environment.

(The accepted answer used to suggest conda create, but that only works on the output of conda list --explicit, not on Conda environment YAML files.)

Upvotes: 37

Mike Müller
Mike Müller

Reputation: 85482

conda env create takes an optional flag --file:

-f FILE, --file FILE environment definition file (default: environment.yml)

So do:

conda env create --file=myfile.yaml

Of course, replace =myfile.yaml with your YAML file name.

Upvotes: 68

Enamul Hassan
Enamul Hassan

Reputation: 5445

conda env create --file=dand-env-win.yaml

worked well for me where my file name was dand-env-win.yaml for a course on the Internet.

Upvotes: 3

Related Questions