diff --git a/changelog-entries/745.md b/changelog-entries/745.md new file mode 100644 index 000000000..95d9e3564 --- /dev/null +++ b/changelog-entries/745.md @@ -0,0 +1 @@ +- Fixed an issue regarding the Python bindings version being ignored in the system tests [#745](https://github.com/precice/tutorials/pull/745) diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index 220a52525..02ff9277d 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -11,6 +11,6 @@ depends_on: volumes: - {{ run_directory }}:/runs command: > - /bin/bash -c "id && + /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && {{ run }} | tee system-tests_{{ case_folder }}.log 2>&1" diff --git a/tools/tests/component-templates/micro-manager.yaml b/tools/tests/component-templates/micro-manager.yaml index 1a78a1b4b..baba7971a 100644 --- a/tools/tests/component-templates/micro-manager.yaml +++ b/tools/tests/component-templates/micro-manager.yaml @@ -5,6 +5,8 @@ build: - {{key}}={{value}} {% endfor %} target: micro_manager +environment: + - PRECICE_TUTORIALS_NO_VENV=1 depends_on: prepare: condition: service_completed_successfully @@ -12,5 +14,6 @@ volumes: - {{ run_directory }}:/runs command: > /bin/bash -c "id && + ([ -z \"$$PRECICE_TUTORIALS_NO_VENV\" ] || { python3 -c 'import precice' || { echo 'ERROR: PRECICE_TUTORIALS_NO_VENV set but precice not importable. Check Docker image.'; exit 1; }; }) && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && {{ run }} | tee system-tests_{{ case_folder }}.log 2>&1" diff --git a/tools/tests/component-templates/nutils-adapter.yaml b/tools/tests/component-templates/nutils-adapter.yaml index 5893c65a7..c7703e60d 100644 --- a/tools/tests/component-templates/nutils-adapter.yaml +++ b/tools/tests/component-templates/nutils-adapter.yaml @@ -5,12 +5,15 @@ build: - {{key}}={{value}} {% endfor %} target: nutils_adapter +environment: + - PRECICE_TUTORIALS_NO_VENV=1 depends_on: prepare: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs command: > - /bin/bash -c "id && + /bin/bash -c "id && + ([ -z \"$$PRECICE_TUTORIALS_NO_VENV\" ] || { python3 -c 'import precice' || { echo 'ERROR: PRECICE_TUTORIALS_NO_VENV set but precice not importable. Check Docker image.'; exit 1; }; }) && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && {{ run }} | tee system-tests_{{ case_folder }}.log 2>&1" diff --git a/tools/tests/component-templates/python-bindings.yaml b/tools/tests/component-templates/python-bindings.yaml index 3cd65d274..3e00c8e53 100644 --- a/tools/tests/component-templates/python-bindings.yaml +++ b/tools/tests/component-templates/python-bindings.yaml @@ -5,12 +5,15 @@ build: - {{key}}={{value}} {% endfor %} target: python_bindings +environment: + - PRECICE_TUTORIALS_NO_VENV=1 depends_on: prepare: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs command: > - /bin/bash -c "id && + /bin/bash -c "id && + ([ -z \"$$PRECICE_TUTORIALS_NO_VENV\" ] || { python3 -c 'import precice' || { echo 'ERROR: PRECICE_TUTORIALS_NO_VENV set but precice not importable. Check Docker image.'; exit 1; }; }) && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && {{ run }} | tee system-tests_{{ case_folder }}.log 2>&1" diff --git a/tools/tests/component-templates/su2-adapter.yaml b/tools/tests/component-templates/su2-adapter.yaml index d466a949a..c6ca56d30 100644 --- a/tools/tests/component-templates/su2-adapter.yaml +++ b/tools/tests/component-templates/su2-adapter.yaml @@ -5,12 +5,15 @@ build: - {{key}}={{value}} {% endfor %} target: su2_adapter +environment: + - PRECICE_TUTORIALS_NO_VENV=1 depends_on: prepare: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs command: > - /bin/bash -c "id && + /bin/bash -c "id && + ([ -z \"$$PRECICE_TUTORIALS_NO_VENV\" ] || { python3 -c 'import precice' || { echo 'ERROR: PRECICE_TUTORIALS_NO_VENV set but precice not importable. Check Docker image.'; exit 1; }; }) && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && SU2_RUN="/home/precice/SU2_RUN/bin" PYTHONPATH="/home/precice/SU2_RUN/bin:$PYTHONPATH" {{ run }} | tee system-tests_{{ case_folder }}.log 2>&1" diff --git a/tools/tests/dockerfiles/ubuntu_2404/Dockerfile b/tools/tests/dockerfiles/ubuntu_2404/Dockerfile index df926fd33..1b6b3ba0c 100644 --- a/tools/tests/dockerfiles/ubuntu_2404/Dockerfile +++ b/tools/tests/dockerfiles/ubuntu_2404/Dockerfile @@ -108,13 +108,14 @@ USER precice WORKDIR /home/precice # Builds the precice python bindings for python3 # Installs also matplotlib as its needed for the elastic-tube 1d fluid-python participant. -RUN python3 -m venv /home/precice/venv && \ +RUN python3 -m venv --system-site-packages /home/precice/venv && \ . /home/precice/venv/bin/activate && \ pip3 install git+https://github.com/precice/python-bindings.git@${PYTHON_BINDINGS_REF} && \ - pip3 install matplotlib + pip3 install matplotlib +ENV VIRTUAL_ENV=/home/precice/venv +ENV PATH="/home/precice/venv/bin:$PATH" -FROM precice_dependecies AS fenics_adapter -COPY --from=python_bindings /home/precice/.local /home/precice/.local +FROM python_bindings AS fenics_adapter USER root RUN add-apt-repository -y ppa:fenics-packages/fenics && \ apt-get -qq update && \ @@ -122,9 +123,8 @@ RUN add-apt-repository -y ppa:fenics-packages/fenics && \ USER precice ARG FENICS_ADAPTER_REF # Building fenics-adapter -RUN python3 -m venv --system-site-packages /home/precice/venv && \ - . /home/precice/venv/bin/activate && \ - pip3 install git+https://github.com/precice/fenics-adapter.git@${FENICS_ADAPTER_REF} +RUN pip3 install --user --break-system-packages \ + git+https://github.com/precice/fenics-adapter.git@${FENICS_ADAPTER_REF} FROM precice_dependecies AS nutils_adapter @@ -135,9 +135,7 @@ RUN apt-get -qq update && \ apt-get -qq install libglu1-mesa libxrender1 libxcursor1 libxft2 libxinerama1 USER precice # Installing nutils - There is no adapter -RUN python3 -m venv /home/precice/venv && \ - . /home/precice/venv/bin/activate && \ - pip3 install nutils +RUN pip3 install nutils FROM precice_dependecies AS calculix_adapter @@ -164,7 +162,6 @@ RUN git clone https://github.com/precice/calculix-adapter.git && \ ln -s /home/precice/calculix-adapter/bin/ccx_preCICE /home/precice/.local/bin/ccx_preCICE FROM python_bindings AS su2_adapter -COPY --from=precice /home/precice/.local /home/precice/.local USER root RUN apt-get -qq update && \ apt-get -qq install swig python3-mpi4py python3-setuptools @@ -177,8 +174,6 @@ WORKDIR /home/precice RUN wget https://github.com/su2code/SU2/archive/refs/tags/v${SU2_VERSION}.tar.gz && \ tar xvzf v${SU2_VERSION}.tar.gz && \ rm -fv v${SU2_VERSION}.tar.gz -RUN python3 -m venv /home/precice/venv && \ - . /home/precice/venv/bin/activate ARG SU2_ADAPTER_PR ARG SU2_ADAPTER_REF WORKDIR /home/precice @@ -216,27 +211,21 @@ RUN git clone https://github.com/precice/dealii-adapter.git &&\ make -j $(nproc) -FROM precice_dependecies AS micro_manager +FROM python_bindings AS micro_manager USER precice WORKDIR /home/precice -COPY --from=precice /home/precice/.local/ /home/precice/.local/ ARG MICRO_MANAGER_REF -RUN python3 -m venv /home/precice/venv && \ - . /home/precice/venv/bin/activate && \ - git clone https://github.com/precice/micro-manager.git && \ +RUN git clone https://github.com/precice/micro-manager.git && \ cd micro-manager && \ if [ -n "${MICRO_MANAGER_PR}" ]; then git fetch origin pull/${MICRO_MANAGER_PR}/head; fi && \ git checkout ${MICRO_MANAGER_REF} && \ pip3 install . +RUN pip3 install pybind11 WORKDIR /home/precice -RUN python3 -m venv /home/precice/venv && \ - . /home/precice/venv/bin/activate && \ - pip3 install pybind11 FROM micro_manager AS dumux_adapter USER root -COPY --from=precice /home/precice/.local/ /home/precice/.local/ ARG DUNE_VERSION ARG DUMUX_VERSION USER precice