diff --git a/.github/workflows/bazeltest.yml b/.github/workflows/bazeltest.yml index 6eb6a261..b893362d 100644 --- a/.github/workflows/bazeltest.yml +++ b/.github/workflows/bazeltest.yml @@ -60,6 +60,10 @@ jobs: - name: Install requirements run: | python3 -m pip install -r requirements.txt + - name: Upgrade libc + # An LLVM update broke this test, fix per is https://bugs.llvm.org/show_bug.cgi?id=27310. + run: | + sudo apt-get upgrade libc-bin=2.31-0ubuntu9.9 - name: Run C++ tests run: | bazel test --config=avx --config=openmp \ diff --git a/install/tests/Dockerfile b/install/tests/Dockerfile index 9998e654..f51eb8f9 100644 --- a/install/tests/Dockerfile +++ b/install/tests/Dockerfile @@ -3,9 +3,15 @@ FROM debian # Install requirements RUN apt-get update -RUN apt-get install -y python3-dev python3-pip +RUN apt-get install -y python3-dev python3-pip python3-venv RUN apt-get install -y cmake git +# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps. +RUN python3 -m venv test_env + +# Activate venv. +ENV PATH="test_env/bin:$PATH" + COPY ./ /qsim/ RUN pip3 install /qsim/ diff --git a/pybind_interface/Dockerfile b/pybind_interface/Dockerfile index b826d197..ffadd4a2 100644 --- a/pybind_interface/Dockerfile +++ b/pybind_interface/Dockerfile @@ -2,11 +2,16 @@ FROM qsim # Install additional requirements -RUN apt-get install -y python3-dev python3-pybind11 python3-pytest python3-pip +RUN apt-get install -y python3-dev python3-pybind11 python3-pip python3-venv -# The --force flag is used mainly so that the old numpy installation from pybind -# gets replaced with the one cirq requires -RUN pip3 install --prefer-binary cirq-core --force +# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps. +RUN python3 -m venv test_env + +# Activate venv. +ENV PATH="test_env/bin:$PATH" + +# break-system-packages flag to override system packages (e.g. numpy) with Cirq's deps. +RUN pip3 install --prefer-binary cirq-core # Copy relevant files COPY ./pybind_interface/ /qsim/pybind_interface/ @@ -18,5 +23,8 @@ WORKDIR /qsim/ # Build pybind code early to cache the results RUN make -C /qsim/ pybind +# Install pytest +RUN pip3 install pytest + # Compile and run qsim tests ENTRYPOINT make -C /qsim/ run-py-tests