Desktop GUI or headless¶
Quantum Metal has two ways to look at a design. Both use the same Python API (designs, components, renderers, analyses); they differ only in where the picture appears.
The desktop GUI (
MetalGUI) is a Qt window with a component library, an options editor, a log and a live plot. Pick this when you work at a laptop or workstation and want to click on, edit and rebuild components interactively. It needs the optional[gui]install (PySide6).Headless means no Qt window.
qm.view(design)returns a matplotlib figure, andqm.gui(design)returns an inline viewer with the samerebuild(),screenshot()andedit_component(...)methods. It runs in a plain script, a Jupyter notebook, a CI job, Colab or Binder, and it is whatpip install quantum-metalgives you by default.
What you give up without the GUI is the point-and-click editing: the dockable panels and the interactive pan/zoom toolbar. Everything else is identical. Designs, GDS export, renderers and analyses do not depend on Qt.
How qm.gui(design) chooses¶
qm.gui(design) returns the desktop MetalGUI when Qt and a display
are available, and the inline MetalGUIHeadless otherwise: no PySide6
installed, a Linux session without DISPLAY, Colab, Binder, or
QISKIT_METAL_HEADLESS=1. qm.gui(design, force_headless=True) forces
the inline viewer for one call. A tutorial written with qm.gui(design)
therefore runs unchanged on a laptop and in the cloud.
Run the tutorials in your browser
The Colab and Binder badges are on the Quick start page. In both, the first cell installs the lite wheel
(pip install -q quantum-metal), and the tutorial’s qm.gui(design)
call picks the inline viewer.
Render without Qt¶
The shortest path to rendering a design without Qt:
import qiskit_metal as qm
from qiskit_metal.designs import DesignPlanar
from qiskit_metal.qlibrary.qubits.transmon_pocket import TransmonPocket
design = DesignPlanar()
TransmonPocket(design, "Q1",
options={"connection_pads": {"a": {}}})
fig = qm.view(design)
fig.savefig("q1.png") # save to file
# or, in a Jupyter notebook, just `fig` displays inline.
qm.view accepts options for customizing the output:
# Render into an existing axes for a multi-panel figure
import matplotlib.pyplot as plt
fig, axes = plt.subplots(1, 2, figsize=(12, 6))
qm.view(design_a, ax=axes[0], title="Design A")
qm.view(design_b, ax=axes[1], title="Design B")
# Render only specific components
qm.view(design, components=["Q1", "Q2"])
# Hide specific layers
qm.view(design, hidden_layers={2})
# Custom figure size
qm.view(design, figsize=(10, 8))
The returned matplotlib.figure.Figure can be saved
(fig.savefig), embedded in a larger figure, or further customized
with the standard matplotlib API.
What works headlessly¶
Everything except the desktop interactive editor:
All component classes in
qiskit_metal.qlibraryDesigns (
DesignPlanar,DesignFlipChip, …)Geometry rendering via
qm.viewGDS export via
QGDSRendererQ3D / HFSS rendering (when run on a machine with Ansys AEDT available — the renderer doesn’t require Qt, but Ansys does)
All
qiskit_metal.analysesmodules
What requires the Qt GUI¶
Only the interactive desktop editor itself:
MetalGUI— the dockable PySide6 windowThe pan/zoom toolbar from
figure_pz()(useqm.view()instead in notebooks for static images, or%matplotlib widget+ipymplfor interactive pan/zoom in Jupyter)
Installing without Qt¶
pip install quantum-metal does not pull in PySide6 or the Qt stack: the base install is headless.
If you have the [gui] extra installed and want to suppress Qt
initialization at runtime (e.g. in a script that runs headlessly),
set the QISKIT_METAL_HEADLESS environment variable:
export QISKIT_METAL_HEADLESS=1
python my_script.py
This prevents matplotlib from switching to the QtAgg backend
during import. The Qt packages stay installed but are never touched.
qm.gui(design) then returns the inline viewer; qm.gui(design,
force_headless=True) does the same for one call, and
QISKIT_METAL_HEADLESS_QUIET=1 hides the one-time notice it prints.
Install extras¶
The extras ([gui], [ansys], [mesh], [skfem], [full]) and what each adds are listed on Installation.
See also¶
qiskit_metal.view()— the headless viewer entry pointqiskit_metal.MetalGUI— the desktop Qt GUI (when you want it)