This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 160
Qiskit Ignis fails if optional matplotlib not installed #532
Labels
bug
Something isn't working
Comments
Ugh, type hints they just cause more trouble than they solve anything. I'll push up a fix removing them there and fix this. Although I'm surprised the minimal dep CI job didn't catch this since it should run all the unit tests without matplotlib. We're probably going to push out a qiskit-terra 0.16.1 in the next week. I'll plan to include an ignis 0.5.1 at the same time to bundle this in the 0.23.1 metapackage release. |
oh, it looks like we lost the minimal deps CI job in the migration to github actions. I'll add that back too |
mtreinish
added a commit
to mtreinish/qiskit-ignis
that referenced
this issue
Nov 4, 2020
In qiskit-community#500 type hints were added for the plotting functions using the optional matplotlib dependencies. This breaks ignis installations without matplotlib present since it's an optional dependency. Since type hints are really just for documentation and not necessary this commit just removes those problematic hints and uses the docstring to document the types. At the same time the testing job verifying ignis works without any optional dependencies that was lost in the migration from travis to github actions is restored to verify that everything works moving forward. Fixes qiskit-community#532
mtreinish
added a commit
to mtreinish/qiskit-ignis
that referenced
this issue
Nov 4, 2020
In qiskit-community#500 type hints were added for the plotting functions using the optional matplotlib dependencies. This breaks ignis installations without matplotlib present since it's an optional dependency. Since type hints are really just for documentation and not necessary this commit just removes those problematic hints and uses the docstring to document the types. At the same time the testing job verifying ignis works without any optional dependencies that was lost in the migration from travis to github actions is restored to verify that everything works moving forward. Fixes qiskit-community#532
Thanks @mtreinish for the fix. I assumed it was something like that, but thanks for the quick fix :) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Informations
What is the current behavior?
Running/importing
base_meas_mitigation.py
fails withoutmatplotlib
installed.Steps to reproduce the problem
Problem source:
https://github.com/Qiskit/qiskit-ignis/blob/c572b34c41a90011cad52e19e09d3a0e446608fe/qiskit/ignis/mitigation/expval/base_meas_mitigator.py#L22-L26
Error lines:
https://github.com/Qiskit/qiskit-ignis/blob/c572b34c41a90011cad52e19e09d3a0e446608fe/qiskit/ignis/mitigation/expval/base_meas_mitigator.py#L168-L170
https://github.com/Qiskit/qiskit-ignis/blob/c572b34c41a90011cad52e19e09d3a0e446608fe/qiskit/ignis/mitigation/expval/base_meas_mitigator.py#L197-L199
https://github.com/Qiskit/qiskit-ignis/blob/c572b34c41a90011cad52e19e09d3a0e446608fe/qiskit/ignis/mitigation/expval/base_meas_mitigator.py#L250
Issue is that
plt
isn't defined ifmatplotlib
isn't installed.What is the expected behavior?
Ignis should run if
matplotlib
is not installed in the environment because it is an optional dependency.Suggested solutions
a. On case of
ImportError
, setplt = unittest.mock.MagicMock()
b. Have
plt.axes
references be forward references by changing to"plt.axes"
(enclosing in string quotes).The text was updated successfully, but these errors were encountered: