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

Support conda/mamba install --copy #267

Merged
merged 2 commits into from
Nov 15, 2022
Merged

Support conda/mamba install --copy #267

merged 2 commits into from
Nov 15, 2022

Conversation

mariusvniekerk
Copy link
Collaborator

No description provided.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for conda-lock ready!

Name Link
🔨 Latest commit b5d3dd9
🔍 Latest deploy log https://app.netlify.com/sites/conda-lock/deploys/636a49c6832d320007e2eb0c
😎 Deploy Preview https://deploy-preview-267--conda-lock.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

conda activate lock && \
mamba env list && \
mamba install --yes pip conda-lock>=1.2.2 setuptools wheel && \
conda-lock lock \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm following correctly, then conda-lock.yml only lives in the Docker cache where it can't be tracked with version control. Do we really want to recommend this?

Copy link
Collaborator Author

@mariusvniekerk mariusvniekerk Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hence the two approaches in this document

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I'm missing something obvious here... I think I don't know what is a "build-container style system".

Two reasons I can think of off the top of my head for locking:

  1. Control explicitly when dependencies are updated
  2. Having an explicit record of the versions installed

It seems like neither of these applies in this case. (For 2. at least there's a file in the container, but if you have to go into the container to see it, you might as well run conda env export.)

What's the benefit to this approach over installing directly from environment.yml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the main benefit is more when you are using something like earthly and have a single earthfile specify multiple docker outputs.

  1. This example does NOT deal with this case
  2. The explicit record is at least kept in the build-container style build described here, which means you can introspect a bit more easily as to what should be in the env.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't know about Earthly. So if I understand correctly, one benefit is that the lockfile can be reused in multiple Dockerfile stages (or similar) to avoid multiple solves.

docs/docker.md Outdated Show resolved Hide resolved
docs/docker.md Outdated Show resolved Hide resolved
Comment on lines +80 to +81
# optionally you can perfom some more cleanup on your conda install after this
# to get a leaner conda environment
Copy link
Contributor

@maresb maresb Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just be explicit here?

Suggested change
# optionally you can perfom some more cleanup on your conda install after this
# to get a leaner conda environment
RUN mamba clean --all --force-pkgs-dirs --yes

conda_lock/conda_lock.py Outdated Show resolved Hide resolved
mariusvniekerk and others added 2 commits November 8, 2022 07:21
Co-authored-by: Ben Mares <services-git-throwaway1@tensorial.com>
@maresb
Copy link
Contributor

maresb commented Nov 8, 2022

BTW, I recently implemented another variation here, actually inspired by this PR, where I use micromamba in a build Docker-stage to generate the Conda environment and then copy the Conda environment into the primary Docker-stage. (As a result, I reduced the image size of the CF automerge bot. 😄)

@mariusvniekerk
Copy link
Collaborator Author

BTW, I recently implemented another variation here, actually inspired by this PR, where I use micromamba in a build Docker-stage to generate the Conda environment and then copy the Conda environment into the primary Docker-stage. (As a result, I reduced the image size of the CF automerge bot. 😄)

This would probably make for a nicer example

@maresb
Copy link
Contributor

maresb commented Nov 11, 2022

This would probably make for a nicer example

Cool, I'll aim to add a MWE along these lines this weekend.

@mariusvniekerk mariusvniekerk merged commit ec2c4bf into main Nov 15, 2022
@dbast dbast deleted the install-copy branch February 6, 2023 11:36
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

Successfully merging this pull request may close these issues.

2 participants