When you try to draw the Graphviz diagram with pass_manager_visualization, You get a PermissionError: [WinError 32] The process cannot access the file because it is being used by another process during running os.remove(tmppath).
How can we reproduce the issue?
from qiskit_ibm_runtime.fake_provider import FakeKyiv
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
pm = generate_preset_pass_manager(optimization_level=2, backend=FakeKyiv())
pm.draw()
What should happen?
Draw the Graphviz diagram
Any suggestions?
Kind of deep copying the image would work.
with Image.open(tmppath) as image_:
image = image_.copy()
os.remove(tmppath)
Environment
What is happening?
When you try to draw the Graphviz diagram with
pass_manager_visualization
, You get aPermissionError: [WinError 32] The process cannot access the file because it is being used by another process
during runningos.remove(tmppath)
.How can we reproduce the issue?
What should happen?
Draw the Graphviz diagram
Any suggestions?
Kind of deep copying the image would work.