From abfb53eb4999a3af8e1cf04261fd25714bf4c9e8 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Mon, 27 Mar 2023 15:06:28 +0100 Subject: [PATCH] Ensure up-to-date `pip`, `setuptools` and `wheel` in CI (#9850) Up-to-date Python packages should not require this step, however there are several packages, especially those that are optional for Terra functionality, that do not yet contain `pyproject.toml` files when building them from source. In these cases, `pip` will begin erroring out from version 23.1 if `wheel` is not installed. This commit proactively ensures that the minimum build dependencies for legacy Python packages is prepared and up-to-date before attempting installations; this includes ensuring that these are updated _inside_ any created venvs as well as outside them. --- .azure/lint-linux.yml | 1 + .azure/test-linux.yml | 1 + .azure/test-macos.yml | 1 + .azure/test-windows.yml | 1 + .azure/tutorials-linux.yml | 2 +- .github/workflows/coverage.yml | 7 +++++++ .github/workflows/randomized_tests.yml | 1 + .github/workflows/slow.yml | 1 + 8 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.azure/lint-linux.yml b/.azure/lint-linux.yml index 0bba15e64ed0..e904c4806636 100644 --- a/.azure/lint-linux.yml +++ b/.azure/lint-linux.yml @@ -21,6 +21,7 @@ jobs: python -m pip install --upgrade pip setuptools wheel virtualenv virtualenv test-job source test-job/bin/activate + pip install -U pip setuptools wheel pip install -U \ -c constraints.txt \ -r requirements.txt \ diff --git a/.azure/test-linux.yml b/.azure/test-linux.yml index 4d2b5cffe2d5..abbdc0cc7ed1 100644 --- a/.azure/test-linux.yml +++ b/.azure/test-linux.yml @@ -60,6 +60,7 @@ jobs: # Use stable Rust, rather than MSRV, to spot-check that stable builds properly. rustup override set stable source test-job/bin/activate + pip install -U pip setuptools wheel # Install setuptools-rust for building sdist pip install -U -c constraints.txt setuptools-rust python setup.py sdist diff --git a/.azure/test-macos.yml b/.azure/test-macos.yml index c1eafa412041..475d009b8ed4 100644 --- a/.azure/test-macos.yml +++ b/.azure/test-macos.yml @@ -34,6 +34,7 @@ jobs: python -m pip install --upgrade pip setuptools wheel virtualenv virtualenv test-job source test-job/bin/activate + pip install -U pip setuptools wheel pip install -U \ -c constraints.txt \ -r requirements.txt \ diff --git a/.azure/test-windows.yml b/.azure/test-windows.yml index 7d4eb0d734ae..fda470e9a92c 100644 --- a/.azure/test-windows.yml +++ b/.azure/test-windows.yml @@ -33,6 +33,7 @@ jobs: python -m pip install --upgrade pip setuptools wheel virtualenv virtualenv test-job source test-job/Scripts/activate + pip install -U pip setuptools wheel pip install -U \ -c constraints.txt \ -r requirements.txt \ diff --git a/.azure/tutorials-linux.yml b/.azure/tutorials-linux.yml index 65221642f2b9..2aa2a851dcd9 100644 --- a/.azure/tutorials-linux.yml +++ b/.azure/tutorials-linux.yml @@ -21,7 +21,7 @@ jobs: - bash: | set -e git clone https://github.com/Qiskit/qiskit-tutorials --depth=1 - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools wheel pip install -U \ -c constraints.txt \ -r requirements.txt \ diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index bf31e54872c2..3ab62d80eb44 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -30,6 +30,13 @@ jobs: cargo install grcov sudo apt-get install lcov + # This is needed to support any requirements, particularly in the `optionals` set, + # that might not have 'pyproject.toml' files specifying their build requirements. + # Modern pip (23.1+) can error out if it doesn't have `wheel` and we ask for one + # of these legacy packages. + - name: Ensure basic build requirements + run: pip install --upgrade pip setuptools wheel + - name: Build and install qiskit-terra run: pip install -e . env: diff --git a/.github/workflows/randomized_tests.yml b/.github/workflows/randomized_tests.yml index 63a4292d9c84..74fbd8ed39ba 100644 --- a/.github/workflows/randomized_tests.yml +++ b/.github/workflows/randomized_tests.yml @@ -15,6 +15,7 @@ jobs: python-version: '3.8' - name: Install dependencies run: | + pip install -U pip setuptools wheel pip install -U -r requirements.txt -c constraints.txt pip install -U -r requirements-dev.txt coveralls -c constraints.txt pip install -c constraints.txt -e . diff --git a/.github/workflows/slow.yml b/.github/workflows/slow.yml index b55043107283..d41398915839 100644 --- a/.github/workflows/slow.yml +++ b/.github/workflows/slow.yml @@ -15,6 +15,7 @@ jobs: python-version: '3.10' - name: Install dependencies run: | + pip install -U pip setuptools wheel pip install -U -r requirements.txt -c constraints.txt pip install -U -r requirements-dev.txt -c constraints.txt pip install -c constraints.txt -e .