setup-miniconda icon indicating copy to clipboard operation
setup-miniconda copied to clipboard

Generate environment from explicit conda lock file

Open valeriupredoi opened this issue 3 years ago • 9 comments

Hey guys, is the setup tool able to generate a conda env straight from an explicit conda lock file by any chance? I tried it here and it complains. Cheers muchly for your help! :beer:

valeriupredoi avatar Jun 08 '21 15:06 valeriupredoi

Thoughts on this @bollwyvl ?

goanpeca avatar Jun 08 '21 17:06 goanpeca

cheers @goanpeca :beer: I managed to find a workaround for this (but it's not elegant) - I tell setup I want this env activated but I don't provide an actual env file, only to create the env from the lockfile inside my workflow. It works and all my dependencies are inside the env created from the lock file. But yeah, it's a way around it :grin:

valeriupredoi avatar Jun 09 '21 08:06 valeriupredoi

sorry, I forgot to link the GA test and workflow

valeriupredoi avatar Jun 09 '21 09:06 valeriupredoi

I thought we had this here: https://github.com/conda-incubator/setup-miniconda#example-7-lockfiles

jaimergp avatar Aug 10 '21 07:08 jaimergp

Here's an aggressive example: https://github.com/robots-from-jupyter/robotframework-jupyterlibrary/blob/master/.github/workflows/ci.yml#L173

To use with a matrix, i pre-calculate the lockfile so it's available to be referenced in a number of places.

bollwyvl avatar Aug 10 '21 12:08 bollwyvl

@jaimergp - hitting this with the example from https://github.com/conda-incubator/setup-miniconda#example-7-lockfiles:

    steps:
      - uses: actions/checkout@v3
      - uses: conda-incubator/setup-miniconda@v2
        with:
          auto-update-conda: false
          activate-environment: explicit-env
          environment-file: conda-lock.yml

conda-lock.yml was generated with conda-lock -f environment.yml -p osx-64

I can reproduce this locally, so it's unclear whether this is a problem with the setup-miniconda action:

$ conda env update --file conda-lock.yml

EnvironmentSectionNotValid: The following sections on '.../conda-lock.yml' are invalid and will be ignored:
 - metadata
 - package
 - version

The returncode is zero, fwiw.

I've attached the conda-lock.yml for reference. conda-lock.yml

cjw296 avatar Sep 23 '22 08:09 cjw296

Conda-lock introduced a new default format, not supported by conda. Use --kind=explicit to get the old behavior.

bollwyvl avatar Sep 23 '22 12:09 bollwyvl

The new format IS supported natively in micromamba though

mariusvniekerk avatar Sep 23 '22 21:09 mariusvniekerk

@mariusvniekerk - hmm, what am I doing wrong?

$ mamba env update  --file conda-lock.yml

EnvironmentSectionNotValid: The following sections on '.../conda-lock.yml' are invalid and will be ignored:
 - metadata
 - package
 - version

cjw296 avatar Sep 24 '22 12:09 cjw296