From 21f4fd27b8cbd212060e00c7a7d621ba12caa4a6 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Mon, 22 Jan 2024 15:52:01 +0000 Subject: [PATCH] Fix pip environment resolution Calling `pip install` multiple times can (deeply unfortunately) allow an environment to become out-of-sync; `pip` doesn't "remember" the constraints of previous installation commands. One of the largest effects here is that doing `pip install -e .` _followed_ by `pip install git+@main` installs `qiskit-terra` from the initial installation (via `qiskit==0.45.2`), then installs `qiskit==1.0.0.dev0` from Git, which is an incompatible environment. Doing the whole environment resolution in a single `pip install` command fixes this, as the `qiskit` dependency is correctly resolved to be _only_ the `1.0.0.dev0` version. --- .github/workflows/ci.yml | 9 +++------ .github/workflows/e2e-tests.yml | 5 ++--- .github/workflows/integration-tests.yml | 3 +-- .github/workflows/q-ctrl-tests.yml | 3 +-- .github/workflows/unit-tests-terra-main.yml | 10 +++++----- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01a763c81b..7601abde1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -c constraints.txt -r requirements-dev.txt + pip install -c constraints.txt -r requirements-dev.txt -e . - name: Run black run: make style - name: Run lint @@ -99,8 +98,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -c constraints.txt -r requirements-dev.txt + pip install -c constraints.txt -r requirements-dev.txt -e . - name: Run unit tests run: make unit-test-coverage - name: Report coverage to coveralls.io @@ -142,8 +140,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -c constraints.txt -r requirements-dev.txt + pip install -c constraints.txt -r requirements-dev.txt -e . - name: Run integration tests run: make integration-test tests-finished: diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 5773e3551f..0738bccc7b 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -47,7 +47,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -c constraints.txt -r requirements-dev.txt + pip install -c constraints.txt -r requirements-dev.txt -e . - name: Run e2e tests - run: make e2e-test \ No newline at end of file + run: make e2e-test diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a3c6c2cf4e..f6b4b4c01d 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,7 +47,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -c constraints.txt -r requirements-dev.txt + pip install -c constraints.txt -r requirements-dev.txt -e . - name: Run integration tests run: make integration-test diff --git a/.github/workflows/q-ctrl-tests.yml b/.github/workflows/q-ctrl-tests.yml index bec27ac697..9711955846 100644 --- a/.github/workflows/q-ctrl-tests.yml +++ b/.github/workflows/q-ctrl-tests.yml @@ -47,7 +47,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -c constraints.txt -r requirements-dev.txt + pip install -c constraints.txt -r requirements-dev.txt -e . - name: Run q-ctrl tests run: python -m unittest test/qctrl/test_qctrl.py diff --git a/.github/workflows/unit-tests-terra-main.yml b/.github/workflows/unit-tests-terra-main.yml index 20f99bcb15..70e0b0933e 100644 --- a/.github/workflows/unit-tests-terra-main.yml +++ b/.github/workflows/unit-tests-terra-main.yml @@ -18,7 +18,7 @@ on: jobs: unit-tests-latest-qiskit-terra: if: github.repository_owner == 'Qiskit' - name: Run unit tests with latest code of qiskit-terra + name: Run unit tests with latest code of Qiskit runs-on: "ubuntu-latest" env: LOG_LEVEL: DEBUG @@ -35,10 +35,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -c constraints.txt -r requirements-dev.txt - pip install -U git+https://github.com/Qiskit/qiskit-terra.git + # Installing the complete environment should happen in one `pip install` step, + # or pip will generally allow broken combinations of packages to be installed. + pip install -c constraints.txt -r requirements-dev.txt -e . git+https://github.com/Qiskit/qiskit.git - name: Run tests # running unit tests against latest (non-released) code of qiskit-terra gives a basic level # of confidence that the integration between qiskit-ibm-runtime and qiskit-terra works - run: make unit-test \ No newline at end of file + run: make unit-test