From 24a30632bdae2b92ecb0bdaf014f81d601f21b3c Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 3 Feb 2026 15:24:26 -0500 Subject: [PATCH 1/4] Fix Docker build on ARM by pre-installing numpy Several dependencies (cantera, pandas, matplotlib, seaborn) require numpy at build time when compiling from source. On ARM architectures where pre-built wheels aren't available, pip would fail because numpy wasn't installed before these packages tried to build. Co-Authored-By: Claude Opus 4.5 --- toolchain/bootstrap/python.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/toolchain/bootstrap/python.sh b/toolchain/bootstrap/python.sh index dc6f0c1de9..3364baddb9 100644 --- a/toolchain/bootstrap/python.sh +++ b/toolchain/bootstrap/python.sh @@ -145,6 +145,17 @@ if ! cmp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/pyproject.toml" > /dev/ fi done + # Pre-install numpy as it's required at build time by several dependencies + # (pandas, cantera, matplotlib, etc.) that may need to compile from source + # on architectures without pre-built wheels (e.g., ARM) + log "(venv) Pre-installing numpy (build-time dependency)." + if ! PIP_DISABLE_PIP_VERSION_CHECK=1 pip3 install numpy; then + error "(venv) Failed to install numpy." + log "(venv) Exiting the$MAGENTA Python$COLOR_RESET virtual environment." + deactivate + exit 1 + fi + if ! PIP_DISABLE_PIP_VERSION_CHECK=1 MAKEFLAGS=$nthreads pip3 install "$(pwd)/toolchain"; then error "(venv) Installation failed." From 85fb909ff2a47c051a58f9b471776f9cf685a489 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 3 Feb 2026 15:54:18 -0500 Subject: [PATCH 2/4] Fix Docker workflow to clone from current repository Use github.repository variable instead of hardcoded MFlowCode/MFC to allow testing on forks. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b12c6cdc5f..e905aae794 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -54,7 +54,7 @@ jobs: TAG="${{ github.event.inputs.tag || github.ref_name }}" echo "tag=$TAG" >> $GITHUB_OUTPUT echo "TAG=$TAG" >> $GITHUB_ENV - git clone --branch "$TAG" --depth 1 https://github.com/MFlowCode/MFC.git mfc + git clone --branch "$TAG" --depth 1 ${{ github.server_url }}/${{ github.repository }}.git mfc - name: Stage run: | From 50a3a24501554652d2ced3d0c2477f5296880456 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 3 Feb 2026 16:10:32 -0500 Subject: [PATCH 3/4] Move numpy pre-install from python.sh to Dockerfile Keep the fix targeted to Docker builds only, where ARM architectures lack pre-built wheels. Normal users aren't affected by unnecessary extra installation steps. Co-Authored-By: Claude Opus 4.5 --- .github/Dockerfile | 7 +++++++ toolchain/bootstrap/python.sh | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/Dockerfile b/.github/Dockerfile index c6a08d8e71..be8a853a98 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -40,6 +40,13 @@ ENV FC=${FC_COMPILER} ENV PATH="${COMPILER_PATH}:$PATH" ENV LD_LIBRARY_PATH="${COMPILER_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH:-}" +# Pre-install numpy into the venv before mfc.sh runs, as it's required at +# build time by several dependencies (pandas, cantera, matplotlib, etc.) that +# may need to compile from source on architectures without pre-built wheels +RUN python3 -m venv /opt/MFC/build/venv && \ + /opt/MFC/build/venv/bin/pip install --upgrade pip && \ + /opt/MFC/build/venv/bin/pip install numpy + RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \ cd /opt/MFC && \ if [ "$TARGET" = "gpu" ]; then \ diff --git a/toolchain/bootstrap/python.sh b/toolchain/bootstrap/python.sh index 3364baddb9..dc6f0c1de9 100644 --- a/toolchain/bootstrap/python.sh +++ b/toolchain/bootstrap/python.sh @@ -145,17 +145,6 @@ if ! cmp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/pyproject.toml" > /dev/ fi done - # Pre-install numpy as it's required at build time by several dependencies - # (pandas, cantera, matplotlib, etc.) that may need to compile from source - # on architectures without pre-built wheels (e.g., ARM) - log "(venv) Pre-installing numpy (build-time dependency)." - if ! PIP_DISABLE_PIP_VERSION_CHECK=1 pip3 install numpy; then - error "(venv) Failed to install numpy." - log "(venv) Exiting the$MAGENTA Python$COLOR_RESET virtual environment." - deactivate - exit 1 - fi - if ! PIP_DISABLE_PIP_VERSION_CHECK=1 MAKEFLAGS=$nthreads pip3 install "$(pwd)/toolchain"; then error "(venv) Installation failed." From 8fec7ad5464ffa3236527c1255b1c5b771041bd3 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 3 Feb 2026 16:24:53 -0500 Subject: [PATCH 4/4] Update Docker to Python 3.12 for pyrometheus compatibility --- .github/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/Dockerfile b/.github/Dockerfile index be8a853a98..5b86e0f711 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -15,17 +15,17 @@ RUN apt-get update -y && \ if [ "$TARGET" != "gpu" ]; then \ apt-get install -y \ build-essential git make cmake gcc g++ gfortran bc \ - python3.11 python3.11-venv python3-pip \ + python3.12 python3.12-venv python3-pip \ openmpi-bin libopenmpi-dev libfftw3-dev \ mpich libmpich-dev; \ else \ apt-get install -y \ build-essential git make cmake bc \ - python3.11 python3.11-venv python3-pip \ + python3.12 python3.12-venv python3-pip \ libfftw3-dev \ openmpi-bin libopenmpi-dev; \ fi && \ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \ + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2 && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ENV OMPI_ALLOW_RUN_AS_ROOT=1 @@ -43,7 +43,7 @@ ENV LD_LIBRARY_PATH="${COMPILER_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH:-}" # Pre-install numpy into the venv before mfc.sh runs, as it's required at # build time by several dependencies (pandas, cantera, matplotlib, etc.) that # may need to compile from source on architectures without pre-built wheels -RUN python3 -m venv /opt/MFC/build/venv && \ +RUN python3.12 -m venv /opt/MFC/build/venv && \ /opt/MFC/build/venv/bin/pip install --upgrade pip && \ /opt/MFC/build/venv/bin/pip install numpy