How to make new anaconda env from yml file

PythonPython 3.xAnaconda

Python Problem Overview


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

Python Solutions


Solution 1 - Python

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

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

Solution 2 - Python

conda env create --file environment.yml

Solution 3 - Python

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

Solution 4 - Python

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)

Solution 5 - Python

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJarvis098View Question on Stackoverflow
Solution 1 - PythonMike MüllerView Answer on Stackoverflow
Solution 2 - PythonMonibaView Answer on Stackoverflow
Solution 3 - PythonLeonardo GonzalezView Answer on Stackoverflow
Solution 4 - PythonAlexView Answer on Stackoverflow
Solution 5 - PythonKushalView Answer on Stackoverflow