From ee519697b555a43f01708a05a8b26b8f93b47692 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 15 Jan 2024 10:13:47 -0500 Subject: [PATCH] Add support for running with Python 3.12 (#2022) * Add support for running with Python 3.12 Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in qiskit-aer. It adds the supported Python version in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release. * Remove numpy constraints * Uncap six * Fix i686 build steps * Use python 3.12.0 in tests to work around unittest breakage in 3.12.1 * Use 3.12.0 for all test jobs --------- Co-authored-by: Jun Doi --- .github/workflows/build.yml | 4 ++-- .github/workflows/deploy.yml | 4 ++-- .github/workflows/tests.yml | 9 ++++----- constraints.txt | 3 --- pyproject.toml | 6 +++--- releasenotes/notes/add-py312-795ffe7d68f41c73.yaml | 4 ++++ setup.py | 1 + tox.ini | 2 +- 8 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/add-py312-795ffe7d68f41c73.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8834b67dbd..9b3540e299 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,7 +132,7 @@ jobs: uses: microsoft/setup-msbuild@v1.0.2 if: runner.os == 'Windows' - name: Install deps - run: python -m pip install -U cibuildwheel==2.11.2 + run: python -m pip install -U cibuildwheel==2.16.2 - name: Build Wheels env: AER_CMAKE_OPENMP_BUILD: 1 @@ -152,7 +152,7 @@ jobs: with: python-version: 3.8 - name: Install deps - run: python -m pip install -U cibuildwheel==2.11.2 + run: python -m pip install -U cibuildwheel==2.16.2 - name: Build Wheels env: CIBW_ARCHS_MACOS: arm64 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 72e0be04de..6c92ad004b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -148,7 +148,7 @@ jobs: env: CIBW_BEFORE_ALL: "yum install -y yum-utils wget && wget -q https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm && rpm -i cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm && yum clean all && yum -y install cuda && yum -y install openblas-devel && yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && yum clean all" CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu11 nvidia-cublas-cu11 nvidia-cusolver-cu11 nvidia-cusparse-cu11 cuquantum-cu11" - CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*" + CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*" CIBW_ENVIRONMENT: QISKIT_AER_PACKAGE_NAME=qiskit-aer-gpu-cu11 QISKIT_AER_CUDA_MAJOR=11 CMAKE_VERBOSE_MAKEFILE=true AER_THRUST_BACKEND=CUDA CUDACXX=/usr/local/cuda/bin/nvcc AER_CUDA_ARCH="7.0 7.2 7.5 8.0 8.6 8.7" AER_PYTHON_CUDA_ROOT=/opt/_internal AER_CIBUILD=true CIBW_REPAIR_WHEEL_COMMAND: 'auditwheel repair --exclude libcudart.so.11.0 --exclude libcustatevec.so.1 --exclude libcutensornet.so.2 --exclude libcutensor.so.1 --exclude libcutensorMg.so.1 --exclude libcusolver.so.11 --exclude libcusolverMg.so.11 --exclude libcusparse.so.11 --exclude libcublas.so.11 --exclude libcublasLt.so.11 -w {dest_dir} {wheel}' run: | @@ -192,7 +192,7 @@ jobs: env: CIBW_BEFORE_ALL: "yum install -y yum-utils wget && wget -q https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda-repo-rhel7-12-2-local-12.2.2_535.104.05-1.x86_64.rpm && rpm -i cuda-repo-rhel7-12-2-local-12.2.2_535.104.05-1.x86_64.rpm && yum clean all && yum -y install nvidia-driver-latest-dkms && yum -y install cuda && yum -y install openblas-devel && yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && yum clean all" CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu12 nvidia-nvjitlink-cu12 nvidia-cublas-cu12 nvidia-cusolver-cu12 nvidia-cusparse-cu12 cuquantum-cu12" - CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*" + CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*" CIBW_ENVIRONMENT: QISKIT_AER_PACKAGE_NAME=qiskit-aer-gpu QISKIT_AER_CUDA_MAJOR=12 CMAKE_VERBOSE_MAKEFILE=true AER_THRUST_BACKEND=CUDA CUDACXX=/usr/local/cuda/bin/nvcc AER_CUDA_ARCH="7.0 7.2 7.5 8.0 8.6 8.7 9.0" AER_PYTHON_CUDA_ROOT=/opt/_internal AER_CIBUILD=true CIBW_REPAIR_WHEEL_COMMAND: 'auditwheel repair --exclude libcudart.so.12 --exclude libcustatevec.so.1 --exclude libcutensornet.so.2 --exclude libcutensor.so.1 --exclude libcutensorMg.so.1 --exclude libcusolver.so.11 --exclude libcusolverMg.so.11 --exclude libcusolver.so.12 --exclude libcusolverMg.so.12 --exclude libcusparse.so.12 --exclude libcublas.so.12 --exclude libcublasLt.so.12 --exclude libnvJitLink.so.12 -w {dest_dir} {wheel}' run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 88a9b13feb..2a6f245ee1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,7 +49,7 @@ jobs: needs: ["lint"] strategy: matrix: - python-version: [3.8, 3.9, "3.10", '3.11'] + python-version: [3.8, 3.9, "3.10", '3.11', "3.12.0"] platform: [ { os: "ubuntu-latest", python-architecture: "x64" }, ] @@ -92,7 +92,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - python-version: [3.8, 3.9, "3.10", "3.11"] + python-version: [3.8, 3.9, "3.10", "3.11", "3.12.0"] os: ["ubuntu-latest"] env: AER_THRUST_BACKEND: OMP @@ -190,7 +190,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - python-version: [3.8, 3.9, "3.10", '3.11'] + python-version: [3.8, 3.9, "3.10", '3.11', "3.12.0"] os: ["macOS-latest"] env: AER_THRUST_BACKEND: OMP @@ -233,7 +233,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - python-version: [3.8, 3.9, "3.10", "3.11"] + python-version: [3.8, 3.9, "3.10", "3.11", "3.12.0"] os: ["windows-2019"] env: AER_THRUST_BACKEND: OMP @@ -280,4 +280,3 @@ jobs: rm -rf qiskit_aer stestr run --slowest shell: bash - \ No newline at end of file diff --git a/constraints.txt b/constraints.txt index 4fe82241ed..a76d3881db 100644 --- a/constraints.txt +++ b/constraints.txt @@ -1,8 +1,5 @@ pylint==2.4.4 astroid==2.3.3 -six>1.10,<=1.14 -numpy>=1.16.3,<1.25 -scipy>=1.0 # Jinja2 3.1.0 is incompatible with sphinx and/or jupyter until they are updated # to work with the new jinja version (the jinja maintainers aren't going to diff --git a/pyproject.toml b/pyproject.toml index 6c9699845a..5543b9f5f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,8 +14,8 @@ build-backend = "setuptools.build_meta" [tool.cibuildwheel] manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" -skip = "pp* cp36* cp37* cp312* *musllinux*" -test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686" +skip = "pp* cp36* cp37* *musllinux*" +test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686 cp312-win32 cp312-manylinux_i686" test-command = "python {project}/tools/verify_wheels.py" # We need to use pre-built versions of Numpy and Scipy in the tests; they have a # tendency to crash if they're installed from source by `pip install`, and since @@ -30,7 +30,7 @@ before-all = "yum install -y openblas-devel" environment = { CMAKE_GENERATOR = "Visual Studio 16 2019"} [[tool.cibuildwheel.overrides]] -select = "cp3{8,9,10,11}-manylinux_i686" +select = "cp3{8,9,10,11,12}-manylinux_i686" before-all = "yum install -y wget && bash {project}/tools/install_openblas_i686.sh && bash {project}/tools/install_rust.sh" [tool.black] diff --git a/releasenotes/notes/add-py312-795ffe7d68f41c73.yaml b/releasenotes/notes/add-py312-795ffe7d68f41c73.yaml new file mode 100644 index 0000000000..a7244cd1fd --- /dev/null +++ b/releasenotes/notes/add-py312-795ffe7d68f41c73.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Added support for running qiskit-aer with Python 3.12. diff --git a/setup.py b/setup.py index 4ac0c20e17..20c5268c84 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering", ] diff --git a/tox.ini b/tox.ini index 7a8d31afd3..5a7d818e42 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.1 -envlist = py37, py38, py39, py310, py311, lint +envlist = py38, py39, py310, py311, py312, lint skipsdist = True [testenv]