-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8486499
commit 9c7f1f3
Showing
3 changed files
with
77 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 50 additions & 37 deletions
87
releasenotes/notes/fix-qpy-symengine-compat-858970a9a1d6bc14.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,63 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed an issue with :func:`.qpy.load` when loading a QPY payload that | ||
contains a :class:`.ParameterExpression` that was generated when symengine | ||
0.11 was installed and trying to load it in an environment where symengine | ||
0.13 (the latest symengine release as of this qiskit release) or vice versa. | ||
Previously, an error would have been raised by symengine around this version | ||
mismatch. This has been worked around for these two specific symengine versions | ||
but if you're trying to use different versions of symengine and there is a | ||
mismatch with this version of Qiskit this might not work. You will need to | ||
install Qiskit >1.3.0 to fix this mismatch issue more broadly for any potential | ||
future version of symengine. | ||
Fixed an issue with :func:`.qpy.load` when loading a QPY file containing | ||
a :class:`.ParameterExpression`, if the versions of ``symengine`` installed | ||
in the generating and loading environments were not the same. For example, | ||
if a QPY file containing :class:`.ParameterExpression`\ s was generated | ||
using Qiskit 1.2.2 with ``symengine==0.11.0`` installed, Qiskit 1.2.2 with | ||
``syengine==0.13.0`` installed would be unable to load it. | ||
Previously, an error would have been raised by ``symengine`` around this | ||
version mismatch. This has been worked around for ``symengine`` 0.11 and | ||
0.13 (there was no 0.12), but if you're trying to use different versions of | ||
``symengine`` and there is a mismatch, this version of Qiskit still might not | ||
work. | ||
issues: | ||
- | | ||
When dumping a QPY file using :func:`.qpy.dump` with the ``version=10`` flag and there are | ||
unbound :class:`.ParameterExpression` in the circuit the output file | ||
will not be loadable by Qiskit 0.45.x or 0.46.x due to incompatibilities | ||
in the symengine serialization used between the symengine libraries used | ||
in the different versions of Qiskit. Qiskit >= 1.0 requires symengine >= | ||
0.11 and Qiskit < 1.0 required symengine >= 0.9.0 and < 0.10.0. Symengine | ||
0.9.x and 0.11.0 (or 0.13.0) don't have a compatible serialization formats | ||
which prevents the files from being loaded. In these cases the only option | ||
available to generate a QPY file with unbound | ||
:class:`.ParameterExpression` that can be loaded with Qiskit 0.45.x or | ||
0.46.x is to set both ``version=10`` and ``use_symengine=False``. | ||
Versions of Qiskit before 1.2.3 will not be able to load QPY files dumped | ||
using :func:`.qpy.dump`, even with ``version`` set appropriately, if: | ||
* there are unbound :class:`.ParameterExpression`\ s in the circuit, | ||
* the ``use_symengine=True`` flag was set (which is the default in Qiskit >= | ||
1.0.0) in :func:`.qpy.dump`, | ||
* the version of ``symengine`` installed in the generating and loading | ||
environments are not within the same minor version (e.g. both 0.11, or | ||
both 0.13). | ||
This applies regardless of the version of Qiskit used in the generation (at | ||
least up to Qiskit 1.2.3 inclusive). | ||
If you want to maximize compatibility with older versions of Qiskit, you | ||
should set ``use_symengine=False``. Newer versions of Qiskit should not | ||
require this. | ||
- | | ||
When loading a QPY file generated with Qiskit 0.45.x or 0.46.x and the | ||
``use_symengine`` flag set to ``True`` (an optional feature), these | ||
payloads are not parsable with Qiskit >= 1.0 (including this release). | ||
This is due to changes in the required symengine versions across the | ||
Qiskit 1.0 major version boundary. Qiskit >= 1.0 requires symengine >= | ||
0.11 and Qiskit < 1.0 required symengine >= 0.9.0 and < 0.10.0. Symengine | ||
0.9.x and 0.11.0 (or 0.13.0) don't have a compatible serialization formats | ||
which prevents newer version of Qiskit from loading those payloads. If you | ||
have a QPY file generated with Qiskit 0.45.x or 0.46.x and the | ||
``use_symengine`` flag was set to ``True`` your only option is to load | ||
the QPY file using Qiskit 0.46.3 and regenerate it using | ||
``use_symengine=False``. | ||
QPY files from the Qiskit 0.45 series can, under a very specific and unlikely | ||
set of circumstances, fail to load with any newer version of Qiskit, | ||
including Qiskit 1.2.3. The criteria are: | ||
* the :class:`.QuantumCircuit` or :class:`.ScheduleBlock` to be dumped | ||
contained unbound :class:`.ParameterExpression` objects, | ||
* the installed version of ``symengine`` was in the 0.9 series (which was the | ||
most recent release during the support window of Qiskit 0.45), | ||
* the ``use_symengine=True`` flag was set (which was *not* the default). | ||
Later versions of Qiskit used during generation are not affected, because | ||
they required newer versions than ``symengine`` 0.9. | ||
In this case, you can recover the QPY file by reloading it with an environment | ||
with Qiskit 0.45.3 and ``symengine`` 0.9.2 installed. Then, use | ||
:func:`.qpy.dump` with ``use_symengine=False`` to re-export the file. This | ||
will then be readable by any newer version of Qiskit. | ||
upgrade: | ||
- | | ||
The requirement on the support versions of `symengine <https://pypi.org/project/symengine/>`__ | ||
has been pre-emptively capped at < 0.14.0 (which is the next minor version as of this release). | ||
This has been done to protect against a potential incompatibility in :mod:`.qpy` when serializing | ||
The supported versions of `symengine <https://pypi.org/project/symengine/>`__ | ||
have been pre-emptively capped at < 0.14.0 (which is expected to be the next | ||
minor version, as of this release of Qiskit). This has been done to protect | ||
against a potential incompatibility in :mod:`.qpy` when serializing | ||
:class:`.ParameterExpression` objects. The serialization used in | ||
:ref:`qpy_format` versions 10, 11, and 12 for :class:`.ParameterExpression` | ||
objects is tied to the symengine version used to generate it and there is the potential | ||
objects is tied to the symengine version used to generate it, and there is the potential | ||
for a future symengine release to not be compatible. This upper version cap is to prevent | ||
a future release of symengine causing incompatibilities when trying to load QPY files | ||
using :class:`.qpy.load`. |