Skip to content

Troubleshooting

The SDK is deliberately loud. It raises rather than falling back to a plausible-looking default, because a quietly wrong error rate is worse than a stack trace. Most of what follows is an intentional guard rail, not a bug.

Quick index

Message contains Cause Section
requires you to accept the Terms and Conditions Terms not yet accepted after install Installation
not enough computation qubits in the network Network too small for the circuit Capacity
is not a perfect square grid4 needs a square qubit count Capacity
network has no magic state factories Fault-tolerant path without a factory Fault tolerance
is below 0.2, where distributed surface code operation has no sub-threshold regime Entanglement too slow to model Fault tolerance
No threshold data for Asked for an unswept parameter row Fault tolerance
must be >= 1 / must be > 0 / must be one of Invalid model parameter Parameters
graphviz_layout / dot not found Graphviz binary missing Plotting
metis is not supported on: Windows pymetis has no Windows build Platform
No module named 'torch' Learned embeddings need the ml extra Platform

Installation

Terms and conditions not accepted

Usage of this SDK requires you to accept the Terms and Conditions
This can easily be accomplished 1 time after installation with:

    python3 -c 'from qndk import show_terms; show_terms()'

The SDK requires a one-time acceptance of the Terms & Conditions per user account before import qndk succeeds. Run the command from a terminal, not from Jupyter or IPython, and answer y:

python3 -c 'from qndk import show_terms; show_terms()'

The acceptance is stored in ~/.cisco/quantum/qndk-terms.json. See Installation.


Capacity

Not enough computation qubits

Exception: not enough computation qubits in the network [2] to allocate
the circuit [20]

The network has fewer compute qubits in total than the circuit has qubits. The two numbers in brackets are exactly that: available, then required.

Fix by growing any of the three dimensions that multiply into capacity:

from qndk.quantum_network import build_clos, QPUSpec

# capacity = comp_qubits x qpus_per_rack x racks
network = build_clos(
    ports_per_switch=4,     # more ports -> more racks
    qpus_per_rack=2,        # more QPUs per rack
    qpu_spec=QPUSpec(comp_qubits=9),
)
print("capacity:", network.total_comp_qubits())

To check before partitioning rather than after:

from qndk.circuit.qiskit_circuits import QiskitCircuit
from qndk.transpile.transpile import TranspiledCircuit
from qndk.quantum_network import build_clos, QPUSpec

circuit = TranspiledCircuit(QiskitCircuit("qft", num_qubits=8))
network = build_clos(ports_per_switch=4, qpus_per_rack=1,
                     qpu_spec=QPUSpec(comp_qubits=4))

fits, needed = circuit.enough_physical_qubits(network)
print(f"fits={fits}  needs={needed}  has={network.total_comp_qubits()}")

grid4 needs a square

ValueError: num_comp_qubits=2 is not a perfect square
(nearest grid is 2x2=4)

QPUSpec(connectivity="grid4") lays qubits out on a square 2D grid, so comp_qubits must be a perfect square — 4, 9, 16, 25. The message tells you the nearest valid grid.

Either round up to a square, or use all2all, which has no such constraint:

from qndk.quantum_network import build_clos, QPUSpec

square = build_clos(ports_per_switch=4, qpus_per_rack=1,
                    qpu_spec=QPUSpec(comp_qubits=9, connectivity="grid4"))
anysize = build_clos(ports_per_switch=4, qpus_per_rack=1,
                     qpu_spec=QPUSpec(comp_qubits=6, connectivity="all2all"))
print(square.total_comp_qubits(), anysize.total_comp_qubits())

Fault tolerance

No magic state factory

Exception: network has no magic state factories -- provision at least one
before calling this, e.g. build_clos(..., num_magic_factories=1)

fault_tolerant_encode() rewrites every T gate into a magic-state consumption, and a magic state has to come from a factory QPU that exists on the network. Factories are provisioned at construction time, because they are hardware:

from qndk.quantum_network import build_clos, QPUSpec

network = build_clos(
    ports_per_switch=4, qpus_per_rack=1,
    qpu_spec=QPUSpec(comp_qubits=4, connectivity="all2all"),
    num_magic_factories=1,
)
factories = [q for q in network.qpu_ids()
             if network.get_qpu(q).is_magic_state_factory]
print("factory qpus:", factories)

fault_tolerant_encode() never augments the network it is handed, so partition.network is network always holds — the value cannot be silently dropped.

Entanglement arrival below the model floor

ValueError: mu=0.05 is below 0.2, where distributed surface code operation
has no sub-threshold regime: the logical error rate stops falling with code
distance, so there is no threshold to extrapolate from. This is a measured
result, not missing data

This is the guard rail working. Below mu = 0.2 pairs per round, the fitted scaling law collapses — code distance stops suppressing error at all, so there is no threshold to extrapolate from and any number returned would be fiction.

If your network really is that slow, the finding is the answer: no code distance rescues it. To model the regime anyway, use FixedIdleEpr, whose table covers a wider range, and treat the result as the conservative bound it is:

from qndk.quantum_error_correction import FixedIdleEpr, PoissonEpr

slow = FixedIdleEpr(k_idle=16)   # pessimistic but defined
ok = PoissonEpr(mu=0.2)          # the lowest mu the Poisson table covers
print(slow.label, "|", ok.label)

No threshold data for that row

ValueError: No threshold data for (policy=sync, mu=0.3, lam_seam=1).
Available: [('async', 0.2, 1), ('async', 0.2, 10), ('async', 0.4, 1), ...]

The threshold tables are fitted from measured Stim sweeps, not computed on demand, so only swept parameter combinations exist. The message lists what is available.

The two models differ here, deliberately:

  • PoissonEpr raises on a miss. Extending its table means re-running the seam sweep, which takes hours, so a miss must fail rather than silently start one. Covered: mu in {0.2, 0.4, 0.6, 0.8, 1.0}, lam_seam in {1, 10}, per policy.
  • FixedIdleEpr computes a missing row on demand via Stim, which takes minutes to hours. Fast path: k_idle in {1, 2, 4, 8, 16} and lam_seam in {1, 4, 8} are a table lookup.

If a call that normally returns instantly hangs for minutes, an off-table FixedIdleEpr row is the likely reason.

Invalid model parameters

ValueError: mu must be > 0, got 0
ValueError: k_idle must be >= 1, got 0
ValueError: policy must be one of ('sync', 'async'), got 'eventually'

Validated when the object is constructed, so they fail immediately rather than deep inside a sweep. The valid policies are exactly "sync" and "async".


Plotting

Plots fail with a graphviz or dot error

The Python binding installs from PyPI; the binary does not. Install it:

brew install graphviz
sudo apt-get install graphviz

Simulation is unaffected — only layout-based plots need it.

A plot window flashes and disappears

Plotting methods take block=False by default so scripts do not stall. Pass block=True on the last figure, or call show() once at the end:

# fragment: opens a window
import matplotlib.pyplot as plt
# ... build figures ...
plt.show()

Nothing renders in a headless environment

Set a non-interactive backend before importing anything that plots:

MPLBACKEND=Agg python3 your_script.py

Platform

METIS on Windows

metis is not supported on: Windows

pymetis has no Windows build, so the dependency is declared for non-Windows platforms only. Use a pure-Python partitioner instead — both are always available and neither needs a system library:

from qndk.partition.kl import KernighanLinPartitioner
from qndk.partition.wbcp import WindowBasedCircuitPartitioner
print(KernighanLinPartitioner.__name__, WindowBasedCircuitPartitioner.__name__)

Encoders need torch

qndk.encoders imports PyTorch and PyTorch Geometric, which arrive with the wheel's [ml] extra:

pip install './qndk-<version>-<python>-<platform>.whl[ml]'

Nothing in the compile, partition or simulate path imports them, so without the extra only qndk.encoders fails.


Performance

A large run takes far longer than expected

Replenishing entangled pairs dominates simulation time on a large topology, because it happens once per remote gate. Things that make it worse:

  • Many QPUs with few communication qubits each. Pre-generation gives up when fewer than two spare comm qubits remain at an endpoint, so it retries constantly. Provision more comm qubits or fewer QPUs.
  • Deep circuits with high remote-gate fraction. Check result.gate_counts()["num_remote"]; if it is most of your gates, the partitioning is the problem, not the simulator.

Turning lookahead off

Entanglement pre-generation is on by default. It is an attribute on the scheduler, so it can be disabled to compare against naive on-demand generation:

# fragment: needs a partition result from an earlier step
scheduler = DQCScheduler(partition)
scheduler.use_epr_lookahead_pregen = False
scheduler.num_lookahead_layers = 2      # only read when the above is True
result = scheduler.run_simulation()

Still stuck

Contact support with the network parameters, the circuit, and the full traceback — see Support. A QuantumNetwork serializes to plain JSON via to_json(), which makes a report reproducible:

import json
from qndk.quantum_network import build_clos, QPUSpec

network = build_clos(ports_per_switch=4, qpus_per_rack=1,
                     qpu_spec=QPUSpec(comp_qubits=4))
blob = json.dumps(network.to_json())
print(f"{len(blob)} bytes of reproducible network description")