Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify version ranges in Conda environment.yml

Tags:

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)?

like image 900
F Lekschas Avatar asked Feb 24 '19 00:02

F Lekschas


People also ask

How do you update a conda environment from Yml?

Update Conda Environments Using a YAML File Once you have created a conda environment, you can update it anytime by first activating the environment and then running the conda env update command.


2 Answers

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.

like image 143
dariober Avatar answered Sep 22 '22 04:09

dariober


You could write something like:

dependencies:   - numpy>=1.2.3, <1.3 
like image 40
Sraw Avatar answered Sep 22 '22 04:09

Sraw