diff --git a/docker/main/ngen/Dockerfile b/docker/main/ngen/Dockerfile index 6bedbd2f6..f126661a9 100644 --- a/docker/main/ngen/Dockerfile +++ b/docker/main/ngen/Dockerfile @@ -65,7 +65,6 @@ ARG BOOST_VERSION=1.82.0 #mpich 3.2 doesn't work well gfortran 11 it seems, an alignment error crops up, but 3.3.2 seems to work... ARG MPICH_VERSION="3.3.2" ARG MIN_PYTHON="3.8.0" -ARG MIN_NUMPY="1.18.0" ARG BLOSC2_VERSION ARG NETCDF_C_VERSION=4.8.1 @@ -291,12 +290,16 @@ FROM rocky-base as rocky-ngen-packaged-deps ARG ROCKY_NGEN_DEPS_REQUIRED +# Set up pip constraints file for this and descendent stages +COPY constraints.txt ${WORKDIR}/constraints.txt +ENV PIP_CONSTRAINT=${WORKDIR}/constraints.txt + # TODO: later, go back and change all pip3/python3 to just pip/python (but leave for now to limit scope) -# Note that this includes numpy, which is needed for Python BMI support, regardless of BMI module +# Note that this includes numpy, which is needed for Python BMI support, regardless of BMI module USER root RUN dnf update -y && dnf install -y ${ROCKY_NGEN_DEPS_REQUIRED} && dnf clean -y all \ && ln -s $(which python3) $(which python3 | sed 's/python3/python/') \ - && pip install --no-cache-dir "pip>=23.0,<23.1" wheel packaging \ + && pip install --no-cache-dir pip wheel packaging \ && if [ "${NGEN_WITH_PYTHON}" == "ON" ]; then pip install --no-cache-dir numpy; fi USER ${USER} @@ -332,7 +335,6 @@ COPY --chown=${USER} --from=download_boost /boost ${WORKDIR}/boost ARG MPICH_VERSION ARG MIN_PYTHON -ARG MIN_NUMPY ARG BLOSC2_VERSION ARG ROCKY_NGEN_DEPS_REQUIRED @@ -784,6 +786,22 @@ FROM rocky-ngen-deps as rocky_ngen_build_testing #FROM ${DOCKER_INTERNAL_REGISTRY}/ngen-deps:latest as rocky_ngen_build_testing COPY --chown=${USER} --from=rocky_init_repo ${WORKDIR}/ngen ${WORKDIR}/ngen + +ENV BOOST_ROOT=${WORKDIR}/boost + +USER root +RUN if [ "${NGEN_WITH_PYTHON}" == "ON" ]; then \ + chgrp -R ${USER} /usr/local/lib*/python3.* ; \ + chmod -R g+sw /usr/local/lib*/python3.* ; \ + fi +USER ${USER} + +ENV VIRTUAL_ENV=/dmod/venv +RUN if [ "${NGEN_WITH_PYTHON}" == "ON" ]; then python3 -m venv ${VIRTUAL_ENV} ; fi +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN if [ "${NGEN_WITH_PYTHON}" == "ON" ]; then pip install numpy ; fi + +RUN cd ${BOOST_ROOT} && tar -xf boost_tarball.blob --strip 1 && rm boost_tarball.blob ENV BOOST_ROOT=${WORKDIR}/boost #COPY --chown=${USER} --from=rocky_build_troute ${WORKDIR}/t-route/wheels /tmp/t-route-wheels #COPY --chown=${USER} --from=rocky_build_troute ${WORKDIR}/t-route/requirements.txt /tmp/t-route-requirements.txt diff --git a/docker/main/ngen/constraints.txt b/docker/main/ngen/constraints.txt new file mode 100644 index 000000000..6a53b3f2b --- /dev/null +++ b/docker/main/ngen/constraints.txt @@ -0,0 +1,5 @@ +### Constrain pip +pip>=23.0,<23.1 + +### Constrain numpy to < 2.0.0 due to current ngen compatibility issue +numpy~=1.0 \ No newline at end of file