How to make new anaconda env from yml file

Question:

enter image description here

I installed anaconda in C:Program FilesAnaconda3. 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

Asked By: Jarvis098

||

Answers:

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

conda env create --name envname --file=environments.yml
Answered By: Mike Müller
conda env create --file environment.yml
Answered By: Moniba

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
Answered By: Leonardo Gonzalez

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

Answered By: Kushal

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)
Answered By: Alex
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.