-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Wrap qiskit.Aer and qiskit.IBMQ with lazy loading object #5619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a77faa3
Wrap qiskit.Aer and qiskit.IBMQ with lazy loading object
mtreinish c12c4c0
Fix lint
mtreinish 1ed63e8
Merge branch 'master' into lazy-load-aer
mtreinish ea8cc7d
Fix test lint
mtreinish ce34092
Merge branch 'lazy-load-aer' of github.com:mtreinish/qiskit-core into…
mtreinish ac9611c
DNM: test with ignis patch
mtreinish 6192981
Revert "DNM: test with ignis patch"
mtreinish 689f28d
Use ignis from source for tutorial job
mtreinish 224c659
Merge remote-tracking branch 'origin/master' into lazy-load-aer
mtreinish 8600253
Merge branch 'master' into lazy-load-aer
mtreinish 78f9217
Merge branch 'master' into lazy-load-aer
mtreinish 59905ec
Merge branch 'master' into lazy-load-aer
mtreinish e25fde8
Merge branch 'master' into lazy-load-aer
mtreinish 2d21def
Merge branch 'master' into lazy-load-aer
mtreinish 20ccd56
Merge branch 'master' into lazy-load-aer
mtreinish 4aac883
Update release note to be more clear
mtreinish c82f230
Merge branch 'master' into lazy-load-aer
mtreinish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
57 changes: 57 additions & 0 deletions
57
releasenotes/notes/lazy-load-provider-factory-bdfb3925a2514ef7.yaml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| --- | ||
| upgrade: | ||
| - | | ||
| The ``qiskit.Aer`` and ``qiskit.IBMQ`` top level attributes are now lazy | ||
| loaded. This means that the objects will always now 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. These | ||
| warnings have been removed and will no longer be emitted at import time | ||
| from the qiskit module. | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.