From 323a330c5f52400ef72e000ac52fdb91288d6c89 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 30 Jan 2024 19:30:36 -0500 Subject: [PATCH] Deprecate qiskit.tools (#11514) * Deprecate qiskit.tools This commit deprecates the qiskit.tools module. Most of the functionality in this module will be removed in the Qiskit 1.0.0 release. The sole exception is the qiskit.tools.parallel module and it's associated public function qiskit.tools.parallel_map which has been moved to qiskit.utils. * Fix lint * Fix lint * test/python/circuit/test_parameters.py * Adjust import path * Add context around QuTiP origins of parallel_map --------- Co-authored-by: Luciano Bello --- qiskit/passmanager/passmanager.py | 2 +- qiskit/test/base.py | 2 +- qiskit/tools/__init__.py | 44 ++-- qiskit/tools/events/__init__.py | 5 + qiskit/tools/events/progressbar.py | 2 +- qiskit/tools/jupyter/__init__.py | 4 + qiskit/tools/monitor/__init__.py | 7 + qiskit/tools/parallel.py | 195 +---------------- .../transpiler/passes/layout/sabre_layout.py | 2 +- qiskit/utils/__init__.py | 12 ++ qiskit/utils/mitigation/_filters.py | 3 +- qiskit/utils/parallel.py | 203 ++++++++++++++++++ .../deprecate-tools-392582e5d3c698eb.yaml | 39 ++++ test/python/circuit/test_parameters.py | 2 +- 14 files changed, 318 insertions(+), 204 deletions(-) create mode 100644 qiskit/utils/parallel.py create mode 100644 releasenotes/notes/deprecate-tools-392582e5d3c698eb.yaml diff --git a/qiskit/passmanager/passmanager.py b/qiskit/passmanager/passmanager.py index 74d5feb91088..f480ff1c3954 100644 --- a/qiskit/passmanager/passmanager.py +++ b/qiskit/passmanager/passmanager.py @@ -21,7 +21,7 @@ import dill -from qiskit.tools.parallel import parallel_map +from qiskit.utils.parallel import parallel_map from .base_tasks import Task, PassManagerIR from .exceptions import PassManagerError from .flow_controllers import FlowControllerLinear diff --git a/qiskit/test/base.py b/qiskit/test/base.py index 70bb097ae4ba..6cfffa1daa13 100644 --- a/qiskit/test/base.py +++ b/qiskit/test/base.py @@ -28,7 +28,7 @@ import unittest from unittest.util import safe_repr -from qiskit.tools.parallel import get_platform_parallel_default +from qiskit.utils.parallel import get_platform_parallel_default from qiskit.utils import optionals as _optionals from qiskit.circuit import QuantumCircuit from .decorators import enforce_subclasses_call diff --git a/qiskit/tools/__init__.py b/qiskit/tools/__init__.py index 6bddd22ba889..c0963cd7c603 100644 --- a/qiskit/tools/__init__.py +++ b/qiskit/tools/__init__.py @@ -17,15 +17,6 @@ .. currentmodule:: qiskit.tools -Parallel Routines ------------------ - -A helper function for calling a custom function with python ``ProcessPoolExecutor``. -Tasks can be executed in parallel using this function. -It has a built-in event publisher to show the progress of the parallel tasks. - -.. autofunction:: parallel_map - Monitoring ---------- @@ -38,7 +29,34 @@ .. automodule:: qiskit.tools.events """ - -from .parallel import parallel_map -from .monitor import job_monitor, backend_monitor, backend_overview -from .events import progressbar +import importlib +import warnings + + +_DEPRECATED_NAMES = { + "parallel_map": "qiskit.utils", + "parallel": "qiskit.utils.parallel", +} + + +_DEPRECATED_REMOVALS = {"job_monitor", "backend_monitor", "backend_overview", "progressbar"} + + +def __getattr__(name): + if name in _DEPRECATED_NAMES: + module_name = _DEPRECATED_NAMES[name] + warnings.warn( + f"Accessing '{name}' from '{__name__}' is deprecated since Qiskit 0.46.0 " + f"and will be removed in Qiskit 1.0.0. Import from '{module_name}' instead ", + DeprecationWarning, + 2, + ) + return getattr(importlib.import_module(module_name), name) + if name in _DEPRECATED_REMOVALS: + warnings.warn( + f"'{name}' has been deprecated and will be removed in Qiskit 1.0.0.", + DeprecationWarning, + 2, + ) + return getattr(importlib.import_module(".monitor", "qiskit.tools"), name) + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") diff --git a/qiskit/tools/events/__init__.py b/qiskit/tools/events/__init__.py index d15a537bb942..d16fe93bfec2 100644 --- a/qiskit/tools/events/__init__.py +++ b/qiskit/tools/events/__init__.py @@ -21,5 +21,10 @@ .. autoclass:: TextProgressBar """ +import warnings from .progressbar import TextProgressBar + +warnings.warn( + "qiskit.tools.events is deprecated and will be removed in Qiskit 1.0.0", DeprecationWarning, 2 +) diff --git a/qiskit/tools/events/progressbar.py b/qiskit/tools/events/progressbar.py index 459662e87a9b..204b982e74e7 100644 --- a/qiskit/tools/events/progressbar.py +++ b/qiskit/tools/events/progressbar.py @@ -48,7 +48,7 @@ import time import datetime import sys -from qiskit.tools.events.pubsub import Subscriber +from .pubsub import Subscriber class BaseProgressBar(Subscriber): diff --git a/qiskit/tools/jupyter/__init__.py b/qiskit/tools/jupyter/__init__.py index 6bc05d46f743..7be4e6b3ec1b 100644 --- a/qiskit/tools/jupyter/__init__.py +++ b/qiskit/tools/jupyter/__init__.py @@ -109,6 +109,10 @@ from .monospace import MonospacedOutput from .job_watcher import JobWatcher, JobWatcherMagic +warnings.warn( + "qiskit.tools.jupyter is deprecated and will be removed in Qiskit 1.0.0", DeprecationWarning, 2 +) + _IP = get_ipython() if _IP is not None: _IP.register_magics(ProgressBarMagic) diff --git a/qiskit/tools/monitor/__init__.py b/qiskit/tools/monitor/__init__.py index cd0f22b90e48..8b64f415c78d 100644 --- a/qiskit/tools/monitor/__init__.py +++ b/qiskit/tools/monitor/__init__.py @@ -12,5 +12,12 @@ """A module for monitoring jobs, backends, etc.""" +import warnings + from .job_monitor import job_monitor from .overview import backend_monitor, backend_overview + + +warnings.warn( + "qiskit.tools.monitor is deprecated and will be removed in Qiskit 1.0.0", DeprecationWarning, 2 +) diff --git a/qiskit/tools/parallel.py b/qiskit/tools/parallel.py index 1b48791e3477..e783d626abe2 100644 --- a/qiskit/tools/parallel.py +++ b/qiskit/tools/parallel.py @@ -1,6 +1,6 @@ # This code is part of Qiskit. # -# (C) Copyright IBM 2017, 2018. +# (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -10,189 +10,14 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# This file is part of QuTiP: Quantum Toolbox in Python. -# -# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the QuTiP: Quantum Toolbox in Python nor the names -# of its contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -############################################################################### - -""" -Routines for running Python functions in parallel using process pools -from the multiprocessing library. -""" - -import os -from concurrent.futures import ProcessPoolExecutor -import sys - -from qiskit.exceptions import QiskitError -from qiskit.utils.multiprocessing import local_hardware_info -from qiskit.tools.events.pubsub import Publisher -from qiskit import user_config - - -def get_platform_parallel_default(): - """ - Returns the default parallelism flag value for the current platform. - - Returns: - parallel_default: The default parallelism flag value for the - current platform. - - """ - # Default False on Windows - if sys.platform == "win32": - parallel_default = False - # On macOS default false on Python >=3.8 - elif sys.platform == "darwin": - parallel_default = False - # On linux (and other OSes) default to True - else: - parallel_default = True - - return parallel_default - - -CONFIG = user_config.get_config() - -if os.getenv("QISKIT_PARALLEL", None) is not None: - PARALLEL_DEFAULT = os.getenv("QISKIT_PARALLEL", None).lower() == "true" -else: - PARALLEL_DEFAULT = get_platform_parallel_default() - -# Set parallel flag -if os.getenv("QISKIT_IN_PARALLEL") is None: - os.environ["QISKIT_IN_PARALLEL"] = "FALSE" - -if os.getenv("QISKIT_NUM_PROCS") is not None: - CPU_COUNT = int(os.getenv("QISKIT_NUM_PROCS")) -else: - CPU_COUNT = CONFIG.get("num_process", local_hardware_info()["cpus"]) - - -def _task_wrapper(param): - (task, value, task_args, task_kwargs) = param - return task(value, *task_args, **task_kwargs) - - -def parallel_map( # pylint: disable=dangerous-default-value - task, values, task_args=(), task_kwargs={}, num_processes=CPU_COUNT -): - """ - Parallel execution of a mapping of `values` to the function `task`. This - is functionally equivalent to:: - - result = [task(value, *task_args, **task_kwargs) for value in values] - - On Windows this function defaults to a serial implementation to avoid the - overhead from spawning processes in Windows. - - Args: - task (func): Function that is to be called for each value in ``values``. - values (array_like): List or array of values for which the ``task`` - function is to be evaluated. - task_args (list): Optional additional arguments to the ``task`` function. - task_kwargs (dict): Optional additional keyword argument to the ``task`` function. - num_processes (int): Number of processes to spawn. - - Returns: - result: The result list contains the value of - ``task(value, *task_args, **task_kwargs)`` for - each value in ``values``. - - Raises: - QiskitError: If user interrupts via keyboard. - - Events: - terra.parallel.start: The collection of parallel tasks are about to start. - terra.parallel.update: One of the parallel task has finished. - terra.parallel.finish: All the parallel tasks have finished. - - Examples: - - .. code-block:: python - - import time - from qiskit.tools.parallel import parallel_map - def func(_): - time.sleep(0.1) - return 0 - parallel_map(func, list(range(10))); - """ - if len(values) == 0: - return [] - if len(values) == 1: - return [task(values[0], *task_args, **task_kwargs)] - - Publisher().publish("terra.parallel.start", len(values)) - nfinished = [0] - - def _callback(_): - nfinished[0] += 1 - Publisher().publish("terra.parallel.done", nfinished[0]) - - # Run in parallel if not Win and not in parallel already - if ( - num_processes > 1 - and os.getenv("QISKIT_IN_PARALLEL") == "FALSE" - and CONFIG.get("parallel_enabled", PARALLEL_DEFAULT) - ): - os.environ["QISKIT_IN_PARALLEL"] = "TRUE" - try: - results = [] - with ProcessPoolExecutor(max_workers=num_processes) as executor: - param = ((task, value, task_args, task_kwargs) for value in values) - future = executor.map(_task_wrapper, param) - - results = list(future) - Publisher().publish("terra.parallel.done", len(results)) - - except (KeyboardInterrupt, Exception) as error: - if isinstance(error, KeyboardInterrupt): - Publisher().publish("terra.parallel.finish") - os.environ["QISKIT_IN_PARALLEL"] = "FALSE" - raise QiskitError("Keyboard interrupt in parallel_map.") from error - # Otherwise just reset parallel flag and error - os.environ["QISKIT_IN_PARALLEL"] = "FALSE" - raise error +# pylint: disable=unused-wildcard-import,missing-module-docstring,wildcard-import +import warnings - Publisher().publish("terra.parallel.finish") - os.environ["QISKIT_IN_PARALLEL"] = "FALSE" - return results +from qiskit.utils.parallel import * - # Cannot do parallel on Windows , if another parallel_map is running in parallel, - # or len(values) == 1. - results = [] - for _, value in enumerate(values): - result = task(value, *task_args, **task_kwargs) - results.append(result) - _callback(0) - Publisher().publish("terra.parallel.finish") - return results +warnings.warn( + "'qiskit.tools.parallel' is deprecated and is now located at 'qiskit.utils.parallel'. This " + "path will no longer work in Qiskit 1.0.0", + DeprecationWarning, + 2, +) diff --git a/qiskit/transpiler/passes/layout/sabre_layout.py b/qiskit/transpiler/passes/layout/sabre_layout.py index ca71ebee2777..2859fb6075c8 100644 --- a/qiskit/transpiler/passes/layout/sabre_layout.py +++ b/qiskit/transpiler/passes/layout/sabre_layout.py @@ -43,7 +43,7 @@ from qiskit.transpiler.passes.routing.sabre_swap import _build_sabre_dag, _apply_sabre_result from qiskit.transpiler.target import Target from qiskit.transpiler.coupling import CouplingMap -from qiskit.tools.parallel import CPU_COUNT +from qiskit.utils.parallel import CPU_COUNT logger = logging.getLogger(__name__) diff --git a/qiskit/utils/__init__.py b/qiskit/utils/__init__.py index 789b8c0da9b0..cdaef40bba15 100644 --- a/qiskit/utils/__init__.py +++ b/qiskit/utils/__init__.py @@ -52,6 +52,15 @@ are run on a device or simulator by passing a QuantumInstance setup with the desired backend etc. +Parallel Routines +----------------- +A helper function for calling a custom function with python +``ProcessPoolExecutor``. Tasks can be executed in parallel using this function. +It has a built-in event publisher to show the progress of the parallel +tasks. + +.. autofunction:: parallel_map + Optional Dependency Checkers (:mod:`qiskit.utils.optionals`) ============================================================ @@ -81,6 +90,8 @@ from .name_unnamed_args import name_args from .algorithm_globals import algorithm_globals +from .parallel import parallel_map + __all__ = [ "LazyDependencyManager", @@ -102,4 +113,5 @@ "local_hardware_info", "is_main_process", "apply_prefix", + "parallel_map", ] diff --git a/qiskit/utils/mitigation/_filters.py b/qiskit/utils/mitigation/_filters.py index d29700338d4e..4bbc30d360f6 100644 --- a/qiskit/utils/mitigation/_filters.py +++ b/qiskit/utils/mitigation/_filters.py @@ -29,7 +29,6 @@ import qiskit from qiskit import QiskitError -from qiskit.tools import parallel_map from qiskit.utils.mitigation.circuits import count_keys from qiskit.utils.deprecation import deprecate_func @@ -112,6 +111,7 @@ def apply(self, raw_data, method="least_squares"): """ from scipy.optimize import minimize from scipy import linalg as la + from qiskit.utils.parallel import parallel_map # pylint: disable=cyclic-import # check forms of raw_data if isinstance(raw_data, dict): @@ -365,6 +365,7 @@ def apply( """ from scipy.optimize import minimize from scipy import linalg as la + from .. import parallel_map # pylint: disable=cyclic-import all_states = count_keys(self.nqubits) num_of_states = 2**self.nqubits diff --git a/qiskit/utils/parallel.py b/qiskit/utils/parallel.py new file mode 100644 index 000000000000..a76de23f03f6 --- /dev/null +++ b/qiskit/utils/parallel.py @@ -0,0 +1,203 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2017, 2018. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +# This file is part of QuTiP: Quantum Toolbox in Python. +# +# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the QuTiP: Quantum Toolbox in Python nor the names +# of its contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +############################################################################### + +# The `parallel_map` function was module was original forked from QuTiP +# at https://github.com/qutip/qutip/blob/v4.2.0/qutip/parallel.py#L190 +# the function has since diverged in Qiskit. + +""" +Routines for running Python functions in parallel using process pools +from the multiprocessing library. +""" + +import os +from concurrent.futures import ProcessPoolExecutor +import sys + +from qiskit.exceptions import QiskitError +from qiskit.tools.events.pubsub import Publisher +from qiskit import user_config + +from .multiprocessing import local_hardware_info + + +def get_platform_parallel_default(): + """ + Returns the default parallelism flag value for the current platform. + + Returns: + parallel_default: The default parallelism flag value for the + current platform. + + """ + # Default False on Windows + if sys.platform == "win32": + parallel_default = False + # On macOS default false on Python >=3.8 + elif sys.platform == "darwin": + parallel_default = False + # On linux (and other OSes) default to True + else: + parallel_default = True + + return parallel_default + + +CONFIG = user_config.get_config() + +if os.getenv("QISKIT_PARALLEL", None) is not None: + PARALLEL_DEFAULT = os.getenv("QISKIT_PARALLEL", None).lower() == "true" +else: + PARALLEL_DEFAULT = get_platform_parallel_default() + +# Set parallel flag +if os.getenv("QISKIT_IN_PARALLEL") is None: + os.environ["QISKIT_IN_PARALLEL"] = "FALSE" + +if os.getenv("QISKIT_NUM_PROCS") is not None: + CPU_COUNT = int(os.getenv("QISKIT_NUM_PROCS")) +else: + CPU_COUNT = CONFIG.get("num_process", local_hardware_info()["cpus"]) + + +def _task_wrapper(param): + (task, value, task_args, task_kwargs) = param + return task(value, *task_args, **task_kwargs) + + +def parallel_map( # pylint: disable=dangerous-default-value + task, values, task_args=(), task_kwargs={}, num_processes=CPU_COUNT +): + """ + Parallel execution of a mapping of `values` to the function `task`. This + is functionally equivalent to:: + + result = [task(value, *task_args, **task_kwargs) for value in values] + + On Windows this function defaults to a serial implementation to avoid the + overhead from spawning processes in Windows. + + Args: + task (func): Function that is to be called for each value in ``values``. + values (array_like): List or array of values for which the ``task`` + function is to be evaluated. + task_args (list): Optional additional arguments to the ``task`` function. + task_kwargs (dict): Optional additional keyword argument to the ``task`` function. + num_processes (int): Number of processes to spawn. + + Returns: + result: The result list contains the value of + ``task(value, *task_args, **task_kwargs)`` for + each value in ``values``. + + Raises: + QiskitError: If user interrupts via keyboard. + + Events: + terra.parallel.start: The collection of parallel tasks are about to start. + terra.parallel.update: One of the parallel task has finished. + terra.parallel.finish: All the parallel tasks have finished. + + Examples: + + .. code-block:: python + + import time + from qiskit.tools.parallel import parallel_map + def func(_): + time.sleep(0.1) + return 0 + parallel_map(func, list(range(10))); + """ + if len(values) == 0: + return [] + if len(values) == 1: + return [task(values[0], *task_args, **task_kwargs)] + + Publisher().publish("terra.parallel.start", len(values)) + nfinished = [0] + + def _callback(_): + nfinished[0] += 1 + Publisher().publish("terra.parallel.done", nfinished[0]) + + # Run in parallel if not Win and not in parallel already + if ( + num_processes > 1 + and os.getenv("QISKIT_IN_PARALLEL") == "FALSE" + and CONFIG.get("parallel_enabled", PARALLEL_DEFAULT) + ): + os.environ["QISKIT_IN_PARALLEL"] = "TRUE" + try: + results = [] + with ProcessPoolExecutor(max_workers=num_processes) as executor: + param = ((task, value, task_args, task_kwargs) for value in values) + future = executor.map(_task_wrapper, param) + + results = list(future) + Publisher().publish("terra.parallel.done", len(results)) + + except (KeyboardInterrupt, Exception) as error: + if isinstance(error, KeyboardInterrupt): + Publisher().publish("terra.parallel.finish") + os.environ["QISKIT_IN_PARALLEL"] = "FALSE" + raise QiskitError("Keyboard interrupt in parallel_map.") from error + # Otherwise just reset parallel flag and error + os.environ["QISKIT_IN_PARALLEL"] = "FALSE" + raise error + + Publisher().publish("terra.parallel.finish") + os.environ["QISKIT_IN_PARALLEL"] = "FALSE" + return results + + # Cannot do parallel on Windows , if another parallel_map is running in parallel, + # or len(values) == 1. + results = [] + for _, value in enumerate(values): + result = task(value, *task_args, **task_kwargs) + results.append(result) + _callback(0) + Publisher().publish("terra.parallel.finish") + return results diff --git a/releasenotes/notes/deprecate-tools-392582e5d3c698eb.yaml b/releasenotes/notes/deprecate-tools-392582e5d3c698eb.yaml new file mode 100644 index 000000000000..485db54151bb --- /dev/null +++ b/releasenotes/notes/deprecate-tools-392582e5d3c698eb.yaml @@ -0,0 +1,39 @@ +--- +deprecations: + - | + The ``qiskit.tools.jupyter`` module has been deprecated and will be removed + in Qiskit 1.0.0. This module is deprecated because the functionality in + this module is tied to the legacy ``qiskit-ibmq-provider`` package which is + no longer supported and also only supported :class:`.BackendV1`. If you're + using this functionality currently, similar jupyter tools exist in the + `qiskit-ibm-provider `__ + package which can be used instead. The documentation for this module can + be found here: + + https://docs.quantum.ibm.com/api/qiskit-ibm-provider/ibm_jupyter + + - | + The ``qiskit.tools.monitor`` module has been deprecated and will be removed + in Qiskit 1.0.0. This module is deprecated because the functionality in + this module is tied to the legacy ``qiskit-ibmq-provider`` package which is + no longer supported and also only supported :class:`.BackendV1`. + - | + The ``qiskit.tools.visualization`` module has been deprecated and will be + removed in Qiskit 1.0.0. This module was a legacy redirect from the original + location of Qiskit's visualization module and was moved to + :mod:`qiskit.visualization` in Qiskit 0.8.0. If you're still using this + path you can just update your imports from ``qiskit.tools.visualization`` + to :mod:`qiskit.visualization`. + - | + The ``qiskit.tools.events`` module and the :func:`.progressbar` utility + it exposed has been deprecated and will be removed in the Qiskit 1.0.0 + release. This module's functionality was not widely used and better covered + by dedicated packages such as `tqdm `__. + - | + The ``qiskit.tools`` module has been deprecated and will be removed in + Qiskit 1.0.0. Except as noted in the release notes above for specific + submodules (``qiskit.tools.jupyter``, ``qiskit.tools.monitor``, ``qiskit.tools.events`` and + ``qiskit.tools.visualization``) the functionality in this module have + been migrated to :mod:`qiskit.utils`. If you're using any functionality + in this module you can update your imports from ``qiskit.tools`` to + :mod:`qiskit.utils`. diff --git a/test/python/circuit/test_parameters.py b/test/python/circuit/test_parameters.py index c983a4abf44f..80c26b5b5c0a 100644 --- a/test/python/circuit/test_parameters.py +++ b/test/python/circuit/test_parameters.py @@ -37,7 +37,7 @@ from qiskit.test import QiskitTestCase from qiskit.providers.basic_provider import BasicSimulator from qiskit.providers.fake_provider import FakeOurense -from qiskit.tools import parallel_map +from qiskit.utils import parallel_map def raise_if_parameter_table_invalid(circuit):