From e58b9a6c27d532be7aea6d4c94ffbf63c74e1294 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Mon, 4 Mar 2024 19:27:33 +0530 Subject: [PATCH 1/7] testing manylinux2014 image --- scripts/Dockerfile | 84 +++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 49 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 8def7ced9e..f57d4aedd7 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -1,12 +1,12 @@ -FROM continuumio/miniconda3:latest - +# FROM continuumio/miniconda3:latest +FROM quay.io/pypa/manylinux2014_x86_64 WORKDIR / # Install the necessary dependencies -RUN apt-get update && apt-get -y upgrade -RUN apt-get install -y libopenblas-dev gcc gfortran graphviz git make g++ build-essential cmake pandoc texlive-latex-extra dvipng -RUN rm -rf /var/lib/apt/lists/* - +RUN yum update && yum upgrade +RUN yum -y install openblas-devel gcc gcc-gfortran graphviz git cmake pandoc texlive dvipng python-devel +# RUN rm -rf /var/lib/apt/lists/* +RUN yum -y groupinstall "Development Tools" RUN useradd -m -s /bin/bash pybamm USER pybamm @@ -17,53 +17,39 @@ RUN git clone https://github.com/pybamm-team/PyBaMM.git WORKDIR /home/pybamm/PyBaMM +RUN mkdir /home/pybamm/.local +RUN mkdir /home/pybamm/.local/lib + ENV CMAKE_C_COMPILER=/usr/bin/gcc ENV CMAKE_CXX_COMPILER=/usr/bin/g++ ENV CMAKE_MAKE_PROGRAM=/usr/bin/make -ENV SUNDIALS_INST=/home/pybamm/.local -ENV LD_LIBRARY_PATH=/home/pybamm/.local/lib - -RUN conda create -n pybamm python=3.11 -RUN conda init --all -SHELL ["conda", "run", "-n", "pybamm", "/bin/bash", "-c"] -RUN conda install -y pip - -ARG IDAKLU -ARG ODES -ARG JAX -ARG ALL - -RUN pip install --upgrade --user pip setuptools wheel wget +ENV SUNDIALS_INST=/home/.local +ENV LD_LIBRARY_PATH=/home/.local/lib + +#RUN conda create -n pybamm python=3.11 +#RUN conda init --all +#SHELL ["conda", "run", "-n", "pybamm", "/bin/bash", "-c"] +#RUN conda install -y pip +# Migrating to venv and create a virtual environment for python 3.11 +USER root + +ENV VIRTUAL_ENV=/home/pybamm/venv +RUN python3.11 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN usermod -aG wheel pybamm + +RUN pip install --upgrade setuptools wheel wget RUN pip install cmake +RUN source /home/pybamm/venv/bin/activate +#USER pybamm +RUN python scripts/install_KLU_Sundials.py +USER root +RUN rm -rf pybind11 +RUN cd /home/pybamm/ && ls -a +RUN git clone https://github.com/pybind/pybind11.git +RUN pip install -e ".[all,dev,docs,jax,odes]" # ODES is not installing, figure out the installation path and add it to the ENV -RUN if [ "$IDAKLU" = "true" ]; then \ - python scripts/install_KLU_Sundials.py && \ - rm -rf pybind11 && \ - git clone https://github.com/pybind/pybind11.git && \ - pip install --user -e ".[all,dev,docs]"; \ - fi - -RUN if [ "$ODES" = "true" ]; then \ - python scripts/install_KLU_Sundials.py && \ - pip install --user -e ".[all,dev,docs,odes]"; \ - fi - -RUN if [ "$JAX" = "true" ]; then \ - pip install --user -e ".[all,dev,docs,jax]"; \ - fi - -RUN if [ "$ALL" = "true" ]; then \ - python scripts/install_KLU_Sundials.py && \ - rm -rf pybind11 && \ - git clone https://github.com/pybind/pybind11.git && \ - pip install --user -e ".[all,dev,docs,jax,odes]"; \ - fi - -RUN if [ -z "$IDAKLU" ] \ - && [ -z "$ODES" ] \ - && [ -z "$JAX" ] \ - && [ -z "$ALL" ]; then \ - pip install --user -e ".[all,dev,docs]"; \ - fi +#USER pybamm ENTRYPOINT ["/bin/bash"] + From 0ff090e8bd3f2eaceba676750d192d29dd13ab7e Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Mon, 4 Mar 2024 23:19:11 +0530 Subject: [PATCH 2/7] changed the inst path to /root --- scripts/Dockerfile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index f57d4aedd7..bd7f888c96 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -16,22 +16,20 @@ WORKDIR /home/pybamm/ RUN git clone https://github.com/pybamm-team/PyBaMM.git WORKDIR /home/pybamm/PyBaMM - +USER root RUN mkdir /home/pybamm/.local -RUN mkdir /home/pybamm/.local/lib ENV CMAKE_C_COMPILER=/usr/bin/gcc ENV CMAKE_CXX_COMPILER=/usr/bin/g++ ENV CMAKE_MAKE_PROGRAM=/usr/bin/make -ENV SUNDIALS_INST=/home/.local -ENV LD_LIBRARY_PATH=/home/.local/lib +ENV SUNDIALS_INST=/root/.local +ENV LD_LIBRARY_PATH=/root/.local/lib64 #RUN conda create -n pybamm python=3.11 #RUN conda init --all #SHELL ["conda", "run", "-n", "pybamm", "/bin/bash", "-c"] #RUN conda install -y pip # Migrating to venv and create a virtual environment for python 3.11 -USER root ENV VIRTUAL_ENV=/home/pybamm/venv RUN python3.11 -m venv $VIRTUAL_ENV @@ -41,13 +39,10 @@ RUN usermod -aG wheel pybamm RUN pip install --upgrade setuptools wheel wget RUN pip install cmake RUN source /home/pybamm/venv/bin/activate -#USER pybamm RUN python scripts/install_KLU_Sundials.py -USER root RUN rm -rf pybind11 -RUN cd /home/pybamm/ && ls -a RUN git clone https://github.com/pybind/pybind11.git -RUN pip install -e ".[all,dev,docs,jax,odes]" # ODES is not installing, figure out the installation path and add it to the ENV +RUN pip install -e ".[all,dev,docs,jax,odes]" # ODES is not installing, installation path /root/.local in centos #USER pybamm From 08d2e073f665a1f4451eafa648e48abc7e6b3e10 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Tue, 5 Mar 2024 19:27:51 +0530 Subject: [PATCH 3/7] dockerfile manylinux2014 build works --- scripts/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index bd7f888c96..69a77f942d 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -22,8 +22,8 @@ RUN mkdir /home/pybamm/.local ENV CMAKE_C_COMPILER=/usr/bin/gcc ENV CMAKE_CXX_COMPILER=/usr/bin/g++ ENV CMAKE_MAKE_PROGRAM=/usr/bin/make -ENV SUNDIALS_INST=/root/.local -ENV LD_LIBRARY_PATH=/root/.local/lib64 +ENV SUNDIALS_INST=/home/pybamm/.local +ENV LD_LIBRARY_PATH=/home/pybamm/.local/lib #RUN conda create -n pybamm python=3.11 #RUN conda init --all @@ -39,7 +39,9 @@ RUN usermod -aG wheel pybamm RUN pip install --upgrade setuptools wheel wget RUN pip install cmake RUN source /home/pybamm/venv/bin/activate +RUN python scripts/install_KLU_Sundials.py --install-dir /home/pybamm/.local RUN python scripts/install_KLU_Sundials.py +RUN mv /home/pybamm/.local/lib64 /home/pybamm/.local/lib RUN rm -rf pybind11 RUN git clone https://github.com/pybind/pybind11.git RUN pip install -e ".[all,dev,docs,jax,odes]" # ODES is not installing, installation path /root/.local in centos From f7d065ab787e1b58acfcb412cf61fc38e321b2d4 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Thu, 7 Mar 2024 01:35:12 +0530 Subject: [PATCH 4/7] migrated to manylinux2014 --- scripts/Dockerfile | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 69a77f942d..d98e86d06d 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -1,12 +1,11 @@ -# FROM continuumio/miniconda3:latest FROM quay.io/pypa/manylinux2014_x86_64 WORKDIR / # Install the necessary dependencies RUN yum update && yum upgrade -RUN yum -y install openblas-devel gcc gcc-gfortran graphviz git cmake pandoc texlive dvipng python-devel -# RUN rm -rf /var/lib/apt/lists/* +RUN yum -y install openblas-devel gcc gcc-gfortran graphviz git cmake pandoc texlive-* wget dvipng python-devel RUN yum -y groupinstall "Development Tools" + RUN useradd -m -s /bin/bash pybamm USER pybamm @@ -17,6 +16,8 @@ RUN git clone https://github.com/pybamm-team/PyBaMM.git WORKDIR /home/pybamm/PyBaMM USER root + +# .local not present by default RUN mkdir /home/pybamm/.local ENV CMAKE_C_COMPILER=/usr/bin/gcc @@ -25,28 +26,24 @@ ENV CMAKE_MAKE_PROGRAM=/usr/bin/make ENV SUNDIALS_INST=/home/pybamm/.local ENV LD_LIBRARY_PATH=/home/pybamm/.local/lib -#RUN conda create -n pybamm python=3.11 -#RUN conda init --all -#SHELL ["conda", "run", "-n", "pybamm", "/bin/bash", "-c"] -#RUN conda install -y pip # Migrating to venv and create a virtual environment for python 3.11 - ENV VIRTUAL_ENV=/home/pybamm/venv RUN python3.11 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN usermod -aG wheel pybamm RUN pip install --upgrade setuptools wheel wget RUN pip install cmake RUN source /home/pybamm/venv/bin/activate -RUN python scripts/install_KLU_Sundials.py --install-dir /home/pybamm/.local -RUN python scripts/install_KLU_Sundials.py -RUN mv /home/pybamm/.local/lib64 /home/pybamm/.local/lib -RUN rm -rf pybind11 -RUN git clone https://github.com/pybind/pybind11.git -RUN pip install -e ".[all,dev,docs,jax,odes]" # ODES is not installing, installation path /root/.local in centos - -#USER pybamm + +RUN python scripts/install_KLU_Sundials.py --install-dir /home/pybamm/.local && \ +python scripts/install_KLU_Sundials.py && \ +mv /home/pybamm/.local/lib64 /home/pybamm/.local/lib && \ +rm -rf pybind11 && \ +git clone https://github.com/pybind/pybind11.git && \ +pip install -e ".[all,dev,docs,jax,odes]"; + +USER pybamm +RUN source /home/pybamm/venv/bin/activate ENTRYPOINT ["/bin/bash"] From 5b7bc7d2cee5c59a98a5d4fbbf06344d48cbc01a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:05:14 +0000 Subject: [PATCH 5/7] style: pre-commit fixes --- scripts/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index d98e86d06d..0d715c1bba 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -3,7 +3,7 @@ WORKDIR / # Install the necessary dependencies RUN yum update && yum upgrade -RUN yum -y install openblas-devel gcc gcc-gfortran graphviz git cmake pandoc texlive-* wget dvipng python-devel +RUN yum -y install openblas-devel gcc gcc-gfortran graphviz git cmake pandoc texlive-* wget dvipng python-devel RUN yum -y groupinstall "Development Tools" RUN useradd -m -s /bin/bash pybamm @@ -40,10 +40,9 @@ python scripts/install_KLU_Sundials.py && \ mv /home/pybamm/.local/lib64 /home/pybamm/.local/lib && \ rm -rf pybind11 && \ git clone https://github.com/pybind/pybind11.git && \ -pip install -e ".[all,dev,docs,jax,odes]"; +pip install -e ".[all,dev,docs,jax,odes]"; USER pybamm RUN source /home/pybamm/venv/bin/activate ENTRYPOINT ["/bin/bash"] - From 04a3b8483f435319a336287c08b2b36c2fe474a2 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Sat, 9 Mar 2024 13:50:43 +0530 Subject: [PATCH 6/7] Migrated to Python Bullseye --- scripts/Dockerfile | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 0d715c1bba..303382b8a6 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -1,10 +1,11 @@ -FROM quay.io/pypa/manylinux2014_x86_64 +FROM python:3.11-slim-bullseye + WORKDIR / # Install the necessary dependencies -RUN yum update && yum upgrade -RUN yum -y install openblas-devel gcc gcc-gfortran graphviz git cmake pandoc texlive-* wget dvipng python-devel -RUN yum -y groupinstall "Development Tools" +RUN apt-get update && apt-get -y upgrade +RUN apt-get install -y libopenblas-dev gcc gfortran graphviz git make g++ build-essential cmake pandoc texlive-latex-extra dvipng +RUN rm -rf /var/lib/apt/lists/* RUN useradd -m -s /bin/bash pybamm USER pybamm @@ -15,10 +16,6 @@ WORKDIR /home/pybamm/ RUN git clone https://github.com/pybamm-team/PyBaMM.git WORKDIR /home/pybamm/PyBaMM -USER root - -# .local not present by default -RUN mkdir /home/pybamm/.local ENV CMAKE_C_COMPILER=/usr/bin/gcc ENV CMAKE_CXX_COMPILER=/usr/bin/g++ @@ -31,18 +28,15 @@ ENV VIRTUAL_ENV=/home/pybamm/venv RUN python3.11 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN pip install --upgrade setuptools wheel wget -RUN pip install cmake -RUN source /home/pybamm/venv/bin/activate +RUN pip install --upgrade setuptools wheel wget && \ +pip install cmake +RUN #!/bin/bash && \ +source /home/pybamm/venv/bin/activate; -RUN python scripts/install_KLU_Sundials.py --install-dir /home/pybamm/.local && \ -python scripts/install_KLU_Sundials.py && \ -mv /home/pybamm/.local/lib64 /home/pybamm/.local/lib && \ +RUN python scripts/install_KLU_Sundials.py && \ rm -rf pybind11 && \ git clone https://github.com/pybind/pybind11.git && \ pip install -e ".[all,dev,docs,jax,odes]"; -USER pybamm -RUN source /home/pybamm/venv/bin/activate ENTRYPOINT ["/bin/bash"] From abc16d0dc62ba5deceebe1af3cfa562c720278c2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 9 Mar 2024 12:36:50 +0000 Subject: [PATCH 7/7] style: pre-commit fixes --- scripts/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 303382b8a6..c31aa3206c 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -5,7 +5,7 @@ WORKDIR / # Install the necessary dependencies RUN apt-get update && apt-get -y upgrade RUN apt-get install -y libopenblas-dev gcc gfortran graphviz git make g++ build-essential cmake pandoc texlive-latex-extra dvipng -RUN rm -rf /var/lib/apt/lists/* +RUN rm -rf /var/lib/apt/lists/* RUN useradd -m -s /bin/bash pybamm USER pybamm @@ -29,7 +29,7 @@ RUN python3.11 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN pip install --upgrade setuptools wheel wget && \ -pip install cmake +pip install cmake RUN #!/bin/bash && \ source /home/pybamm/venv/bin/activate;