diff --git a/qiskit/tools/parallel.py b/qiskit/tools/parallel.py index 9013b1562c38..ca88c5368234 100644 --- a/qiskit/tools/parallel.py +++ b/qiskit/tools/parallel.py @@ -65,6 +65,9 @@ # Default False on Windows if sys.platform == "win32": PARALLEL_DEFAULT = False + # On python 3.9 default false to avoid deadlock issues + elif sys.version_info[0] == 3 and sys.version_info[1] == 9: + PARALLEL_DEFAULT = False # On macOS default false on Python >=3.8 elif sys.platform == "darwin": if sys.version_info[0] == 3 and sys.version_info[1] >= 8: diff --git a/releasenotes/notes/disable-39-multirpc-8618c89aeaa620f9.yaml b/releasenotes/notes/disable-39-multirpc-8618c89aeaa620f9.yaml new file mode 100644 index 000000000000..bfc3e0b16bc0 --- /dev/null +++ b/releasenotes/notes/disable-39-multirpc-8618c89aeaa620f9.yaml @@ -0,0 +1,20 @@ +--- +issues: + - | + When running :func:`~qiskit.tools.parallel_map` (and functions that + internally call :func:`~qiskit.tools.parallel_map` such as + :func:`~qiskit.compiler.transpile` and :func:`~qiskit.compiler.assemble`) + on Python 3.9 with ``QISKIT_PARALLEL`` set to True in some scenarios it is + possible for the program to deadlock and never finish running. To avoid + this from happening the default for Python 3.9 was changed to not run in + parallel, but if ``QISKIT_PARALLEL`` is explicitly enabled then this + can still occur. +upgrade: + - | + The default value for ``QISKIT_PARALLEL`` on Python 3.9 environments has + changed to ``False``, this means that when running on Python 3.9 by default + multiprocessing will not be used. This was done to avoid a potential + deadlock/hanging issue that can occur when running multiprocessing on + Python 3.9 (see the known issues section for more detail). It is still + possible to manual enable it by explicitly setting the ``QISKIT_PARALLEL`` + environment variable to ``TRUE``.