Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using conda-lock.yml result in "EnvironmentSectionNotValid". #284

Open
ubaldot opened this issue May 9, 2023 · 3 comments
Open

using conda-lock.yml result in "EnvironmentSectionNotValid". #284

ubaldot opened this issue May 9, 2023 · 3 comments

Comments

@ubaldot
Copy link

ubaldot commented May 9, 2023

I created a conda-lock.yml and I followed the guide in the README in this repo.

  mamba_tests:
    name: Tests with conda/mamba
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: ["ubuntu-latest", "macos-latest", "windows-latest"]
    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

When running the workflow, I get the following error:

...
Updating 'explicit-env' env from conda env update...
  /usr/share/miniconda/condabin/conda env update --name explicit-env --file ./conda-lock.yml
  /home/runner/work/_actions/conda-incubator/setup-miniconda/v2/dist/setup/index.js:26904
                              throw new Error(`"${command}" failed with "${forced_error}"`);
                              ^
  
  Error: "/usr/share/miniconda/condabin/conda,env,update,--name,explicit-env,--file,./conda-lock.yml" failed with "EnvironmentSectionNotValid"

I generated the conda-lock file with conda-lock -f pyproject.toml

@goanpeca
Copy link
Member

goanpeca commented May 10, 2023

Hi @ubaldot, thanks for the issue

I do not think we support that (conda-lock -f pyproject.toml), as the format file that conda-lock generates is not installable directly by the command we are using: conda env update --name explicit-env --file ./conda-lock.yml you would need to generate conda-lock files that conda can use (older version format?) or use conda list --explicit which is not using conda-lock at all.

@ubaldot
Copy link
Author

ubaldot commented May 10, 2023

Hola Gonzalo,
Thanks for your reply and for the tips in using conda list --explicit.
I have two question though

  1. What is the difference between conda-lock and conda list --explicit (or simply conda list --export)?
  2. Perhaps the README should be updated? I used the conda-lock thing because I read it from the README :)

Best,
/U.

@goanpeca
Copy link
Member

goanpeca commented May 10, 2023

Hello,

  1. conda-lock is a different tool so you need to use it to generate lock files and to be able to install them (in the latest version and default format). The other options use conda directly so conda can install the output of those commands. So to be able to generate conda-lock files that conda understands, then you need to use the explicit format. From the docs https://conda.github.io/conda-lock/output/

Explicit lockfile
The legacy format that conda lock supports. This was the default format prior to conda-lock 1.0.
This format is understood natively by both conda and mamba. If your lock contains pip solved packages these can only be installed by conda-lock

  1. Indeed, we could add a note so that users know that they can use conda-lock, but need to use the explicit (legacy) format which is what conda currently understands.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants