Use conda-lock to generate environment.lock (closes #975)#1063
Open
munishchouhan wants to merge 2 commits into
Open
Use conda-lock to generate environment.lock (closes #975)#1063munishchouhan wants to merge 2 commits into
munishchouhan wants to merge 2 commits into
Conversation
The current templates run `micromamba env export --name base --explicit` which silently omits any `pip:` entries from environment.yml, so users with mixed conda+pip environments get incomplete lock files. Switch the lockfile generation step in the conda-file templates (v1 and v2, dockerfile and singularity) to install `conda-lock` and invoke it against the user's conda.yml. The actual `micromamba install` step that builds the image is left unchanged, so image contents are produced exactly as before — conda-lock is used only to render the lockfile. Closes #975 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The conda-lock binary lives at /opt/conda/bin/conda-lock after the `micromamba install conda-forge::conda-lock` step, but /opt/conda/bin is not on PATH inside the mambaorg/micromamba build stage. The previous template invoked `conda-lock ...` directly and failed with `bash: line 1: conda-lock: command not found` (exit 127). Run it via `micromamba run -n base` instead so the base env's PATH is resolved correctly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cristianrcv
approved these changes
Jun 25, 2026
pditommaso
requested changes
Jun 25, 2026
pditommaso
left a comment
Collaborator
There was a problem hiding this comment.
This may go into into a new template version
Collaborator
|
Related #1064 |
Member
Author
ok sure i will create v3 |
Collaborator
|
Let's discuss first what's the best approach for this |
Member
Author
I think we have three options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
micromamba env export --name base --explicittoconda-lockfor generatingenvironment.lock.micromamba env export --explicitsilently omits anypip:entries fromenvironment.yml, leaving users with mixed conda+pip environments holding an incomplete lock file.conda-lockunderstandspipsections and includes them in the lockfile.micromamba installstep that materializes the base env is left untouched, so image contents are produced exactly as before — conda-lock is used only to render the lockfile (so this is a minimal-risk change to image behavior).What changed
src/main/resources/templates/conda-micromamba-v1/dockerfile-conda-file.txtsrc/main/resources/templates/conda-micromamba-v1/singularityfile-conda-file.txtsrc/main/resources/templates/conda-micromamba-v2/dockerfile-conda-file.txtsrc/main/resources/templates/conda-micromamba-v2/singularityfile-conda-file.txtTemplateUtilsTestandContainerHelperTestupdated for the new template output.The
conda-packagesvariants (inline package lists / lock-URL flow) are not changed: they don't accept a conda.yml and inline CLI args can't carrypip:deps, so conda-lock offers no benefit there.Test plan
TemplateUtilsTestpasses (34 tests)ContainerHelperTestpasses (107 tests)environment.ymlproduces a lockfile containing the pip packagesCONDA_LOCK_START/CONDA_LOCK_ENDextraction inBuildLogServiceImplstill works with the conda-lock unified lockfile formatCloses #975
🤖 Generated with Claude Code