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

Allow micromamba provisioning in Linux too #2097

Merged
merged 5 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda_smithy/data/conda-forge.json
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@
}
],
"default": "micromamba",
"description": "Use this option to choose which tool is used to provision the tooling in your\nfeedstock. Defaults to micromamba.\n\nIf conda or mamba are chosen, the latest Miniforge will be used to\nprovision the base environment. If micromamba is chosen, Miniforge\nis not involved; the environment is created directly by micromamba.\n\nNote: micromamba is only used on macOS and Windows for now.\nOn Linux, mamba (as provided in the Docker images) will still be used\neven if micromamba is chosen.",
"description": "Use this option to choose which tool is used to provision the tooling in your\nfeedstock. Defaults to micromamba.\n\nIf conda or mamba are chosen, the latest Miniforge will be used to\nprovision the base environment. If micromamba is chosen, Miniforge\nis not involved; the environment is created directly by micromamba.",
"title": "Conda Install Tool"
},
"conda_forge_output_validation": {
Expand Down
4 changes: 0 additions & 4 deletions conda_smithy/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,6 @@ class ConfigModel(BaseModel):
If conda or mamba are chosen, the latest Miniforge will be used to
provision the base environment. If micromamba is chosen, Miniforge
is not involved; the environment is created directly by micromamba.

Note: micromamba is only used on macOS and Windows for now.
On Linux, mamba (as provided in the Docker images) will still be used
even if micromamba is chosen.
"""
),
)
Expand Down
16 changes: 12 additions & 4 deletions conda_smithy/templates/build_steps.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ conda-build:
root-dir: ${FEEDSTOCK_ROOT}/build_artifacts
pkgs_dirs:
- ${FEEDSTOCK_ROOT}/build_artifacts/pkg_cache
{%- if conda_install_tool == "micromamba" %}
- /opt/mamba/pkgs
{%- endif %}
- /opt/conda/pkgs
{%- if conda_solver %}
solver: {{ conda_solver }}
{%- endif %}

CONDARC

{%- if conda_install_tool == "micromamba" %}
micromamba create --root-prefix /opt/conda --prefix /opt/mamba \
--yes --quiet --override-channels --channel conda-forge --strict-channel-priority \
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }}
{%- endif %}
Copy link
Member

Choose a reason for hiding this comment

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

Why can't we just install into /opt/conda?

Copy link
Member Author

Choose a reason for hiding this comment

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

micromamba doesn't allow --prefix and --root-prefix to be the same, so this is the quickest way to reuse the /opt/conda cache. We also avoid history related problems.

If you want to reuse /opt/conda, we could:

  1. Move /opt/conda/pkgs to the chosen mamba root prefix (e.g. ~/.conda)
  2. Clear /opt/conda/conda-meta/history
  3. micromamba install ... into /opt/conda

Do you prefer that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wait maybe we don't need (1). Let me check something.

Copy link
Member

@isuruf isuruf Oct 17, 2024

Choose a reason for hiding this comment

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

What's the issue with using something like

CONDA_PKGS_DIRS=/opt/conda micromamba install conda-forge-ci-setup --prefix /opt/conda --root-prefix /opt/mamba

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, yep, that's what I tested in conda-forge/dav1d-feedstock#21. Let me clean up and push.


{%- if conda_build_tool == "mambabuild" %}
{%- set BUILD_CMD="conda-mambabuild" %}
{%- elif conda_build_tool == "conda-build+conda-libmamba-solver" %}
Expand All @@ -47,12 +57,10 @@ CONDARC
{%- if conda_solver == "libmamba" %}
export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1
{%- endif %}
{%- if conda_install_tool == "micromamba" %}
{%- set conda_install_tool = "mamba" %}
{%- endif %}

{%- if conda_install_tool in ("conda", "mamba") %}
{{ conda_install_tool }} install --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }}
{%- endif %}
{%- if conda_install_tool == "mamba" and (conda_build_tool_deps != "" or conda_install_tool_deps != "") %}
{{ conda_install_tool }} update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \
pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup_update) }}
Expand Down
Loading