How to specify version ranges in Conda environment.yml


Is it possible to specify version ranges in an environment.yml file for Conda packages?

The official documentation mentions a few examples that rely on the asterisks (*) and I am wondering if that is the only feature or whether Conda supports other more sophisticated version ranges such as those supported by npm.

For example, is it possible to install any patch version that is higher or equal to 1.2.3 (e.g., 1.2.10 would be fine but 1.3.0 is not)?

Asked By: F Lekschas



You could write something like:

  - numpy>=1.2.3, <1.3
Answered By: Sraw

I think/assume that the syntax specifying versions is the one documented at Package match specifications.

So you would write - numpy >=1.2.3,<1.3 (space after numpy, no space after the comma – not tested).

BTW, I couldn’t find any documentation describing the structure of the environment file environment.yml. creating-an-environment-from-an-environment-yml-file refers to Creating an environment file manually and vice-versa.

Answered By: dariober