qiskit/releasenotes/notes/0.17/lazy-load-provider-factory-...

58 lines
2.1 KiB
YAML

---
upgrade:
- |
The ``qiskit.Aer`` and ``qiskit.IBMQ`` top level attributes are now lazy
loaded. This means that the objects will now always exist and warnings will
no longer be raised on import if ``qiskit-aer`` or ``qiskit-ibmq-provider``
are not installed (or can't be found by Python). If you were checking for
the presence of ``qiskit-aer`` or ``qiskit-ibmq-provider`` using these
module attributes and explicitly comparing to ``None`` or looking for the
absence of the attribute this no longer will work because they are always
defined as an object now. In other words running something like::
try:
from qiskit import Aer
except ImportError:
print("Aer not available")
or::
try:
from qiskit import IBMQ
except ImportError:
print("IBMQ not available")
will no longer work. Instead to determine if those providers are present
you can either explicitly use ``qiskit.providers.aer.Aer`` and
``qiskit.providers.ibmq.IBMQ``::
try:
from qiskit.providers.aer import Aer
except ImportError:
print("Aer not available")
try:
from qiskit.providers.ibmq import IBMQ
except ImportError:
print("IBMQ not available")
or check ``bool(qiskit.Aer)`` and ``bool(qiskit.IBMQ)`` instead, for
example::
import qiskit
if not qiskit.Aer:
print("Aer not available")
if not qiskit.IBMQ:
print("IBMQ not available")
This change was necessary to avoid potential import cycle issues between
the qiskit packages and also to improve the import time when Aer or IBMQ
are not being used.
- |
The user config file option ``suppress_packaging_warnings`` option in the
user config file and the ``QISKIT_SUPPRESS_PACKAGING_WARNINGS`` environment
variable no longer has any effect and will be silently ignored. The warnings
this option controlled have been removed and will no longer be emitted at
import time from the ``qiskit`` module.