Jarvis098
Jarvis098

Reputation: 1780

How to make new anaconda env from yml file

enter image description here

I installed anaconda in C:\Program Files\Anaconda3. Every time to create a new env, I just do cmd and write:

conda create --name envname python=3.5

But how can i install a new env from the "environments.yml" file

enter image description here

Upvotes: 104

Views: 266554

Answers (5)

Alex
Alex

Reputation: 3431

To sum up (as of conda 4.8.4) conda env create and conda create are two fundamentally different commands.

conda create

  • this is the official (quasi-recommended) command to create envs, listed in the general commands section of the docs
  • conda create --file expects a requirements.txt, not an environment.yml, each line in the given file is treated as a package-reference

conda env create

  • instead, this command is needed to create an environment from a given environment.yml
  • environment.yml files have a specific syntax (e.g. for env name, source channels, packages)
  • e.g. conda env create --file environment.yml
  • some flags available with conda create are not available with conda env create, such as --strict-channel-priority, which may result in some confusion
  • conda env create is only mentioned deep into the docs of conda (although I think it is the more common command to use)

Upvotes: 43

Kushal
Kushal

Reputation: 41

Worked for me on anaconda, mini conda Replace the .yml file path to location of environment.yml file.

conda env create --prefix ./env -f ../yml file path/environment.yml

Upvotes: 4

Leonardo Gonzalez
Leonardo Gonzalez

Reputation: 1529

The above answers did not work for me with conda 4.7.12, but this (from the Anaconda documentation) did:

conda env create -f environment.yml

Upvotes: 97

Moniba
Moniba

Reputation: 869

conda env create --file environment.yml

Upvotes: 30

Mike Müller
Mike Müller

Reputation: 85482

conda env create allows an option --file for an environment file:

conda env create --name envname --file=environments.yml

Upvotes: 162

Related Questions