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/channel-transport-reaction/chemical-fenics/run.sh b/channel-transport-reaction/chemical-fenics/run.sh index e0927a968..4517b279a 100755 --- a/channel-transport-reaction/chemical-fenics/run.sh +++ b/channel-transport-reaction/chemical-fenics/run.sh @@ -6,7 +6,7 @@ exec > >(tee --append "$LOGFILE") 2>&1 if [ ! -v PRECICE_TUTORIALS_NO_VENV ] then - python3 -m venv --system-site-package .venv + python3 -m venv --system-site-packages .venv . .venv/bin/activate pip install -r requirements.txt && pip freeze > pip-installed-packages.log fi diff --git a/channel-transport-reaction/fluid-fenics/run.sh b/channel-transport-reaction/fluid-fenics/run.sh index ff60931b0..9addd4fef 100755 --- a/channel-transport-reaction/fluid-fenics/run.sh +++ b/channel-transport-reaction/fluid-fenics/run.sh @@ -6,7 +6,7 @@ exec > >(tee --append "$LOGFILE") 2>&1 if [ ! -v PRECICE_TUTORIALS_NO_VENV ] then - python3 -m venv --system-site-package .venv + python3 -m venv --system-site-packages .venv . .venv/bin/activate pip install -r requirements.txt && pip freeze > pip-installed-packages.log fi diff --git a/elastic-tube-3d/solid-fenics/run.sh b/elastic-tube-3d/solid-fenics/run.sh index a06dd46bb..48d3be2d0 100755 --- a/elastic-tube-3d/solid-fenics/run.sh +++ b/elastic-tube-3d/solid-fenics/run.sh @@ -6,7 +6,7 @@ exec > >(tee --append "$LOGFILE") 2>&1 if [ ! -v PRECICE_TUTORIALS_NO_VENV ] then - python3 -m venv --system-site-package .venv + python3 -m venv --system-site-packages .venv . .venv/bin/activate pip install -r requirements.txt && pip freeze > pip-installed-packages.log fi diff --git a/flow-over-heated-plate/fluid-su2/run.sh b/flow-over-heated-plate/fluid-su2/run.sh index db3ab8b76..4788f832b 100755 --- a/flow-over-heated-plate/fluid-su2/run.sh +++ b/flow-over-heated-plate/fluid-su2/run.sh @@ -6,7 +6,7 @@ exec > >(tee --append "$LOGFILE") 2>&1 if [ ! -v PRECICE_TUTORIALS_NO_VENV ] then - python3 -m venv --system-site-package .venv + python3 -m venv --system-site-packages .venv . .venv/bin/activate pip install -r requirements.txt && pip freeze > pip-installed-packages.log fi diff --git a/flow-over-heated-plate/solid-fenics/run.sh b/flow-over-heated-plate/solid-fenics/run.sh index 3a0977996..310a8fb12 100755 --- a/flow-over-heated-plate/solid-fenics/run.sh +++ b/flow-over-heated-plate/solid-fenics/run.sh @@ -6,7 +6,7 @@ exec > >(tee --append "$LOGFILE") 2>&1 if [ ! -v PRECICE_TUTORIALS_NO_VENV ] then - python3 -m venv --system-site-package .venv + python3 -m venv --system-site-packages .venv . .venv/bin/activate pip install -r requirements.txt && pip freeze > pip-installed-packages.log fi diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index 220a52525..8cb66443a 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -5,12 +5,15 @@ build: - {{key}}={{value}} {% endfor %} target: fenics_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/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 f9aabd4c4..c56715eef 100644 --- a/tools/tests/dockerfiles/ubuntu_2404/Dockerfile +++ b/tools/tests/dockerfiles/ubuntu_2404/Dockerfile @@ -107,13 +107,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 && \ @@ -121,18 +122,14 @@ 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 && \ +RUN . /home/precice/venv/bin/activate && \ pip3 install git+https://github.com/precice/fenics-adapter.git@${FENICS_ADAPTER_REF} -FROM precice_dependecies AS nutils_adapter -COPY --from=python_bindings /home/precice/.local /home/precice/.local +FROM python_bindings AS nutils_adapter 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 @@ -159,7 +156,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 @@ -172,8 +168,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 @@ -211,27 +205,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