-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Circuit draw does not close rendered image which appears in the next plot #13878
Comments
@ironfrown Could you give a minimal working example, maybe this will show the way to look for the root problem. There are other visual errors as well for example: Problem with graph in some API docs #13558. |
By the way, the bug shows in both Chrome and Firefox, both tested in Jupyter Lab 4.3.5 |
I could not replicate the problem with xx_qiskit_draw_bug_test.ipynb in Chrome, however I tested with Jupyterlab 4.1.5 and VScode. |
Tomorrow, I'll try a minimum install to eliminate possible package interaction and let you know. |
@ironfrown: could you run import matplotlib
matplotlib.get_backend() and share the result? We have code that attempts to auto-close the figure if we detect that you're using |
@BramDo @jakelishman I think I have found the source of the problem, I walked through my installs. The problem appears when you install "spyder" into the environment (using conda). By the way:
Which seems to have changed after installing "spyder" (from 'tkagg'). |
However, when checking the environment in Jupyter lab, it is "inline" (as requested) |
I am not sure if this is helpful, however, when I set "%matplotlib tkagg", then the first chart plot opens up in "Figure 1", the next circuit draw opens in "Figure 2", however, the subsequent chart plot opens in the same "Figure 2" and includes both. |
A temporary solution is not to install "spyder" in the Qiskit environment (once installed, uninstalling it does nothing). The same may be applicable to other packages relying on QT rather than TK graphical environment. |
Yeah, matplotlib has an order of backends, and I don't immediately know of the best way to detect an |
@jakelishman so is this "bug" resolved (by avoiding spyder) or someone is going to look at closing figures after circuit draw? |
There's still a problem with our heuristic for auto-closing figures, but I can't promise that I'll have time to look deeply into it any time soon. "Don't use spyder" is a workaround more than a fix haha |
Environment
What is happening?
When drawing a circuit followed by chart plotting, the image of the circuit also appears, see below.
How can we reproduce the issue?
Create a circuit, draw it, then plot a matplotlib chart (with %matplotlib inline), used jupyterlab 4.3.5.
What should happen?
Circuit draw should close its rendered image
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: