From 9c474cf11c455457c3cf062f419cda2982daf733 Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Tue, 10 Oct 2023 13:30:41 -0500 Subject: [PATCH 1/3] Try using libmamba solver for conda packaging It is [officially supported by conda](https://www.anaconda.com/blog/conda-is-fast-now), and it is significantly faster. Before this commit, Windows packaging usually takes 1 hour and 15 minutes. Mac packaging usually takes about 45 minutes. Linux usually takes about 35 minutes. We'll see if there are any noticeable differences. Signed-off-by: Patrick Avery --- .github/workflows/container_build.sh | 4 ++++ .github/workflows/package.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/container_build.sh b/.github/workflows/container_build.sh index 9c2911edf..55bbf01b0 100755 --- a/.github/workflows/container_build.sh +++ b/.github/workflows/container_build.sh @@ -21,6 +21,10 @@ ${HOME}/miniconda3/bin/conda create --override-channels -c conda-forge -y -n hex ${HOME}/miniconda3/bin/activate hexrd ${HOME}/miniconda3/bin/conda activate hexrd +# Install the libmamba solver (it is much faster) +${HOME}/miniconda3/bin/conda install -n base -c conda-forge conda-libmamba-solver +${HOME}/miniconda3/bin/conda config --set solver libmamba + # Install conda build and create output directory ${HOME}/miniconda3/bin/conda install --override-channels -c conda-forge conda-build -y mkdir output diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index b959c9470..51694d85b 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -46,6 +46,9 @@ jobs: - name: Install build requirements run: | conda activate hexrd + # Change default solver to be libmamba, so that it runs much faster + conda install -n base -c conda-forge conda-libmamba-solver + conda config --set solver libmamba # FIXME: downgrade urllib3 until this issue is fixed: # https://github.com/Anaconda-Platform/anaconda-client/issues/654 conda install --override-channels -c conda-forge anaconda-client conda-build conda 'urllib3<2.0.0' From e576070188e32d6245f6e34e32b0c649ae731388 Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Tue, 10 Oct 2023 15:43:42 -0500 Subject: [PATCH 2/3] TEST: Set solver again to make sure it works Signed-off-by: Patrick Avery --- .github/workflows/package.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 51694d85b..2ce017cea 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -45,10 +45,11 @@ jobs: - name: Install build requirements run: | - conda activate hexrd # Change default solver to be libmamba, so that it runs much faster conda install -n base -c conda-forge conda-libmamba-solver conda config --set solver libmamba + + conda activate hexrd # FIXME: downgrade urllib3 until this issue is fixed: # https://github.com/Anaconda-Platform/anaconda-client/issues/654 conda install --override-channels -c conda-forge anaconda-client conda-build conda 'urllib3<2.0.0' @@ -61,8 +62,15 @@ jobs: if: ${{ matrix.config.name != 'Linux' }} run: | conda activate hexrd + conda install -n base -c conda-forge conda-libmamba-solver + conda install -c conda-forge conda-libmamba-solver + conda config --set solver libmamba + conda config --env --set solver libmamba mkdir output - conda build --override-channels -c conda-forge --output-folder output/ conda.recipe/ + # Conda build is ignoring the .condarc for some reason, so we need to + # set this environment variable instead. + export CONDA_SOLVER=libmamba + CONDA_SOLVER=libmamba conda build --override-channels -c conda-forge --output-folder output/ conda.recipe/ # This is need to ensure ~/.profile or ~/.bashrc are used so the activate # command works. shell: bash -l {0} From 86473753f34c7c8e32258c4adbf46a648c93210e Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Wed, 11 Oct 2023 17:50:55 -0500 Subject: [PATCH 3/3] Test specific instructions It worked in the last commit, let's see if we can simplify it. Signed-off-by: Patrick Avery --- .github/workflows/package.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2ce017cea..e05fc4cc9 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -62,15 +62,17 @@ jobs: if: ${{ matrix.config.name != 'Linux' }} run: | conda activate hexrd - conda install -n base -c conda-forge conda-libmamba-solver + # For some reason, we need to set this in the environment as well. + # It seems conda build sometimes needs the solver in the environment + # and sometimes in the base environment. I don't know why. conda install -c conda-forge conda-libmamba-solver - conda config --set solver libmamba conda config --env --set solver libmamba mkdir output # Conda build is ignoring the .condarc for some reason, so we need to # set this environment variable instead. + # Setting this variable via `env` did not seem to work for some reason. export CONDA_SOLVER=libmamba - CONDA_SOLVER=libmamba conda build --override-channels -c conda-forge --output-folder output/ conda.recipe/ + conda build --override-channels -c conda-forge --output-folder output/ conda.recipe/ # This is need to ensure ~/.profile or ~/.bashrc are used so the activate # command works. shell: bash -l {0}