From 82df009c8034697fdcc85bea7180a416f689aca1 Mon Sep 17 00:00:00 2001 From: Pierce Zhang <143103585+isosafrasaurus@users.noreply.github.com> Date: Mon, 6 Oct 2025 03:18:15 -0500 Subject: [PATCH] Pinned build tools to fix petsc4py, SymPy to avoid FFC/FIAT crash during DOLFIN build Added pip3 install --upgrade pip setuptools wheel. Pinned Cython to 3.0.x: pip3 install "Cython>=3.0,<3.1" to avoid the Cython 3.1.x crash in petsc4py 3.20.x. Installed petsc4py/slepc4py with --no-build-isolation and explicit PETSC_DIR / SLEPC_DIR so they use the preinstalled Cython. pip3 install "sympy>=1.12.1,<1.14" --- tacc-mvapich2.3-ib-python3.12/Dockerfile | 67 +++++++++--------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/tacc-mvapich2.3-ib-python3.12/Dockerfile b/tacc-mvapich2.3-ib-python3.12/Dockerfile index cd63206..f685bf9 100644 --- a/tacc-mvapich2.3-ib-python3.12/Dockerfile +++ b/tacc-mvapich2.3-ib-python3.12/Dockerfile @@ -1,10 +1,7 @@ # Builds a Docker image for running FEniCS on TACC machines -# The image is at: # -# https://hub.docker.com/r/uvilla/fenics-2019.1-tacc-mvapich2.3-ib -# -# This is a modified version of -# https://bitbucket.org/fenics-project/docker/src/master/dockerfiles/dev-env/Dockerfile +# This is a modified version of +# https://bitbucket.org/fenics-project/docker/src/master/dockerfiles/dev-env/Dockerfile # # See License for further information # @@ -16,16 +13,12 @@ FROM tacc/tacc-ubuntu18-mvapich2.3-ib - RUN useradd -m -s /bin/bash -G sudo fenics && \ echo "fenics:docker" | chpasswd - - USER root WORKDIR /tmp -# Environment variables ENV FENICS_HOME=/home/fenics ENV PETSC_VERSION=3.20.2 \ SLEPC_VERSION=3.20.1 \ @@ -38,10 +31,8 @@ ENV PETSC_VERSION=3.20.2 \ OPENBLAS_VERBOSE=0 \ FENICS_PREFIX=$FENICS_HOME/local -# Non-Python utilities and libraries RUN apt-get -qq update && \ - apt-get -y --with-new-pkgs \ - -o Dpkg::Options::="--force-confold" upgrade && \ + apt-get -y --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \ apt-get -y install curl && \ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ apt-get -y install \ @@ -78,7 +69,7 @@ RUN apt-get -qq update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Build python 3.12 from source +# Build Python 3.12 from source RUN apt-get -qq update && \ apt-get -y install build-essential libssl-dev zlib1g-dev libbz2-dev \ libreadline-dev libsqlite3-dev wget curl llvm \ @@ -96,8 +87,7 @@ RUN update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python # Install Python3 based environment RUN apt-get -qq update && \ - apt-get -y --with-new-pkgs \ - -o Dpkg::Options::="--force-confold" upgrade && \ + apt-get -y --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \ apt-get -y install \ python3-dev \ python3-flufl.lock \ @@ -110,7 +100,7 @@ RUN apt-get -qq update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Install setuptools +# Install pip / setuptools for Python 3.12 RUN wget https://bootstrap.pypa.io/pip/get-pip.py && \ python3 get-pip.py && \ pip3 install --no-cache-dir setuptools && \ @@ -118,8 +108,6 @@ RUN wget https://bootstrap.pypa.io/pip/get-pip.py && \ # Install PETSc from source RUN apt-get -qq update && \ - # apt-get -y install \ - # python-minimal && \ wget -nc --quiet https://gitlab.com/petsc/petsc/-/archive/v${PETSC_VERSION}/petsc-v${PETSC_VERSION}.tar.gz -O petsc-${PETSC_VERSION}.tar.gz && \ mkdir -p petsc-src && tar -xf petsc-${PETSC_VERSION}.tar.gz -C petsc-src --strip-components 1 && \ cd petsc-src && \ @@ -138,7 +126,7 @@ RUN apt-get -qq update && \ --download-spai \ --download-suitesparse \ --download-superlu \ - --download-hdf5\ + --download-hdf5 \ --download-strumpack \ --download-ml \ --prefix=/usr/local/petsc-32 && \ @@ -150,11 +138,7 @@ ENV HDF5_ROOT=/usr/local/petsc-32 ENV SCOTCH_DIR=/usr/local/petsc-32 # Install SLEPc from source -# NOTE: Had issues building SLEPc from source tarball generated by bitbucket. -# Website tarballs work fine, however. RUN apt-get -qq update && \ - # apt-get -y install \ - # python-minimal && \ wget -nc --quiet https://gitlab.com/slepc/slepc/-/archive/v${SLEPC_VERSION}/slepc-v${SLEPC_VERSION}.tar.gz -O slepc-${SLEPC_VERSION}.tar.gz && \ mkdir -p slepc-src && tar -xf slepc-${SLEPC_VERSION}.tar.gz -C slepc-src --strip-components 1 && \ export PETSC_DIR=/usr/local/petsc-32 && \ @@ -164,27 +148,26 @@ RUN apt-get -qq update && \ make install && \ rm -rf /tmp/* -# By default use the 32-bit build of SLEPc and PETSc. +# By default use the 32-bit build of SLEPc and PETSc ENV SLEPC_DIR=/usr/local/slepc-32 \ PETSC_DIR=/usr/local/petsc-32 -# Install jupyterlab, sympy, mpi4py, petsc4py, slepc4py and pybind11 from source. -RUN pip3 install --no-cache-dir jupyter jupyterlab matplotlib scipy sympy tqdm pkgconfig && \ - pip3 install --no-cache-dir mpi4py==${MPI4PY_VERSION} && \ - pip3 install --no-cache-dir petsc4py==${PETSC4PY_VERSION} && \ - pip3 install --no-cache-dir slepc4py==${SLEPC4PY_VERSION} && \ - pip3 install --no-cache-dir pybind11==${PYBIND11_VERSION} && \ - wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz && \ - tar -xf v${PYBIND11_VERSION}.tar.gz && \ - cd pybind11-${PYBIND11_VERSION} && \ - mkdir build && \ - cd build && \ - cmake -DPYBIND11_TEST=False ../ && \ - make && \ - make install && \ - rm -rf /tmp/* +# Pin Cython to 3.0.x for petsc4py/slepc4py 3.20.x +# Pin SymPy to <1.14 to avoid FIAT/FFC crash during DOLFIN doc/demo generation +RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel \ + && pip3 install --no-cache-dir "Cython>=3.0,<3.1" \ + && pip3 install --no-cache-dir jupyter jupyterlab matplotlib scipy "sympy>=1.12.1,<1.14" tqdm pkgconfig \ + && pip3 install --no-cache-dir mpi4py==${MPI4PY_VERSION} \ + && PETSC_DIR=/usr/local/petsc-32 pip3 install --no-cache-dir --no-build-isolation petsc4py==${PETSC4PY_VERSION} \ + && SLEPC_DIR=/usr/local/slepc-32 pip3 install --no-cache-dir --no-build-isolation slepc4py==${SLEPC4PY_VERSION} \ + && wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz \ + && tar -xf v${PYBIND11_VERSION}.tar.gz \ + && cd pybind11-${PYBIND11_VERSION} \ + && mkdir build && cd build \ + && cmake -DPYBIND11_TEST=False ../ \ + && make && make install \ + && rm -rf /tmp/* -# Our helper scripts WORKDIR $FENICS_HOME COPY fenics.env.conf $FENICS_HOME/fenics.env.conf COPY bin $FENICS_HOME/bin @@ -211,6 +194,6 @@ RUN /home/fenics/bin/fenics-pull && \ /home/fenics/bin/fenics-build # symbol link ufl to ufl_legacy -RUN ln -s /usr/local/lib/python3.12/site-packages/ufl_legacy /usr/local/lib/python3.12/site-packages/ufl +RUN ln -s /usr/local/lib/python3.12/site-packages/ufl_legacy /usr/local/lib/python3.12/site-packages/ufl || true -RUN ldconfig \ No newline at end of file +RUN ldconfig