Skip to content

Commit

Permalink
Pin setuptools in CI (Qiskit#8526)
Browse files Browse the repository at this point in the history
* Pin setuptools in CI

The recently released setuptools 64.0.0 release introduced a regression
that prevents editable installs from working (see pypa/setuptools#3498).
This is blocking CI as we use editable installs to build and install
terra for testing. When there is an upstream release fixing this issue
we can remove the pins.

* Remove pip/setuptools/wheel manual install step

* Try venv instead of virtualenv

* Revert "Try venv instead of virtualenv"

This reverts commit 3ada819.

* Revert "Remove pip/setuptools/wheel manual install step"

This reverts commit 831bc6e.

* Pin in constraints.txt too

* Lower version further

* Pin setuptools-rust too

* Set editable install to legacy mode via env var

* Set env variable correctly everywhere we build terra

* Add missing env variable setting for image tests
  • Loading branch information
mtreinish authored Aug 12, 2022
1 parent a278047 commit 82e38d1
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .azure/docs-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ jobs:

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel
pip install -U tox
python -m pip install --upgrade pip 'setuptools<64.0.0' wheel -c constraints.txt
pip install -U tox -c constraints.txt
sudo apt-get update
sudo apt-get install -y graphviz
displayName: 'Install dependencies'
- bash: |
tox -edocs
displayName: 'Run Docs build'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- task: ArchiveFiles@2
inputs:
Expand Down
4 changes: 3 additions & 1 deletion .azure/lint-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ jobs:

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
python -m pip install --upgrade pip 'setuptools<64.0.0' wheel virtualenv -c constraints.txt
virtualenv test-job
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
pip install -U "qiskit-aer" -c constraints.txt
python setup.py build_ext --inplace
displayName: 'Install dependencies'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- bash: |
set -e
Expand Down
7 changes: 6 additions & 1 deletion .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
python -m pip install --upgrade pip 'setuptools<64.0.0' wheel virtualenv -c constraints.txt
virtualenv test-job
displayName: "Prepare venv"
Expand All @@ -82,6 +82,9 @@ jobs:
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
displayName: "Install Terra directly"
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- bash: |
set -e
Expand Down Expand Up @@ -165,6 +168,8 @@ jobs:
sudo apt-get install -y graphviz pandoc
image_tests/bin/pip check
displayName: 'Install dependencies'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- bash: image_tests/bin/python -m unittest discover -v test/ipynb
displayName: 'Run image test'
4 changes: 3 additions & 1 deletion .azure/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ jobs:

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
python -m pip install --upgrade pip 'setuptools<64.0.0' wheel virtualenv -c constraints.txt
virtualenv test-job
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
python setup.py build_ext --inplace
pip check
displayName: 'Install dependencies'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- bash: |
set -e
Expand Down
4 changes: 3 additions & 1 deletion .azure/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
python -m pip install --upgrade pip 'setuptools<64.0.0' wheel virtualenv -c constraints.txt
virtualenv test-job
source test-job/Scripts/activate
pip install -r requirements.txt -r requirements-dev.txt -c constraints.txt
Expand All @@ -39,6 +39,8 @@ jobs:
python setup.py build_ext --inplace
pip check
displayName: 'Install dependencies'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- bash: |
set -e
Expand Down
2 changes: 2 additions & 0 deletions .azure/tutorials-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
sudo apt-get install -y graphviz pandoc
pip check
displayName: 'Install dependencies'
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- bash: |
set -e
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
run: pip install tox coveragepy-lcov
- name: Run coverage report
run: tox -ecoverage
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- name: Convert to lcov
run: coveragepy-lcov --output_file_path coveralls.info
- name: Coveralls
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/randomized_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
pip install -c constraints.txt -e .
pip install "qiskit-ibmq-provider" -c constraints.txt
pip install "qiskit-aer"
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
- name: Run randomized tests
run: make test_randomized
- name: Create comment on failed test run
Expand Down
4 changes: 4 additions & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ pyparsing<3.0.0
# to work with the new jinja version (the jinja maintainers aren't going to
# fix things) pin to the previous working version.
jinja2==3.0.3

# setuptools 64.0.0 breaks editable installs. Pin to an old version until
# see https://github.com/pypa/setuptools/issues/3498
setuptools==63.3.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "wheel", "setuptools-rust"]
requires = ["setuptools", "wheel", "setuptools-rust<1.5.0"]
build-backend = "setuptools.build_meta"

[tool.black]
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
setuptools-rust
setuptools-rust<1.5.0
coverage>=4.4.0
hypothesis>=4.24.3
python-constraint>=1.4
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ setenv =
QISKIT_SUPRESS_PACKAGING_WARNINGS=Y
QISKIT_TEST_CAPTURE_STREAMS=1
QISKIT_PARALLEL=FALSE
passenv = RAYON_NUM_THREADS OMP_NUM_THREADS QISKIT_PARALLEL
passenv = RAYON_NUM_THREADS OMP_NUM_THREADS QISKIT_PARALLEL SETUPTOOLS_ENABLE_FEATURES
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-dev.txt
commands =
Expand Down

0 comments on commit 82e38d1

Please sign in to comment.