Skip to content

General-purpose SDKs

qibo

Maintained by Quantum-TII

Qibo is an open-source full stack API for quantum simulation and quantum hardware control.

PythonApache-2.0
qibo illustration

Resource snapshot

Category

General-purpose SDKs

Stars

357

Last pushed

May 26, 2026Updated 3mo ago

Open issues

103

Quickstart

Get running in a few lines.

Quickstart
from qibo.models import QFT

# Create a QFT circuit with 15 qubits
circuit = QFT(15)

# Simulate final state wavefunction default initial state is |00>
final_state = circuit()

What it is

qibo is maintained by Quantum-TII and sits in the General-purpose SDKs lane of the open-source quantum map.

Qibo is an open-source full stack API for quantum simulation and quantum hardware control. It commonly appears alongside quantumlib-cirq, qiskit-qiskit, quantumlib-stim in example workflows.

Last verified by Qtangl generator on May 27, 2026

Who it's for

Developers who want a broad entry point for building circuits, experimenting with algorithms, and integrating quantum workflows into larger applications.

What you can build or learn

  • Prototype end-to-end circuit workflows without committing to a niche backend too early.
  • Learn how the project represents circuits, gates, jobs, and results.
  • Compare how a major ecosystem frames practical quantum development.

Code samples

Examples from the repository.

Canonizator (examples/3_tangle/canonizator.py)
import numpy as np
from scipy.optimize import minimize
from qibo import Circuit, gates
def ansatz(p=0):
    """Ansatz for driving a random state into its up-tp-phases canonical form.
    Args:
      p (float): probability of occuring a single-qubit depolarizing error
    Returns:
      Qibo circuit implementing the variational ansatz.
    """
    circuit = Circuit(3, density_matrix=p > 0)
    for qubit in range(3):
        circuit.add(gates.RZ(qubit, theta=0))
        circuit.add(gates.RY(qubit, theta=0))
        circuit.add(gates.RZ(qubit, theta=0))
        if p > 0:
            circuit.add(
                gates.PauliNoiseChannel(
                    qubit, [("X", p / 3), ("Y", p / 3), ("Z", p / 3)]
                )
            )
    for qubit in range(3):
        if p > 0:
            circuit.add(gates.PauliNoiseChannel(qubit, [("X", 10 * p)]))
        circuit.add(gates.M(qubit))
    return circuit
def cost_function(theta, state, circuit, shots: int = 1000):
    """Cost function encoding the difference between a state and its up-to-phases canonical form.
    Args:
        theta (ndarray): parameters of the unitary rotations.
        state (ndarray): three-qubit random state.
        circuit (:class:`qibo.models.Circuit`): variational circuit.
        shots (int, optional): shots used for measuring every circuit. Defaults to :math:`1000`.
    Returns:
        float: Cost function
    """
    circuit.set_parameters(theta)
    measurements = circuit(state, nshots=shots).frequencies(binary=False)
    return (measurements[1] + measurements[2] + measurements[3]) / shots
def canonize(state, circuit, shots: int = 1000):
Main (examples/3_tangle/main.py)
import argparse
import matplotlib.pyplot as plt
import numpy as np
from canonizator import *
parser = argparse.ArgumentParser()
parser.add_argument("--N", default=100, help="Number of random states.", type=int)
parser.add_argument(
    "--p", default=0.001, help="Probability of occurring an error.", type=float
)
parser.add_argument(
    "--shots", default=1000, help="Shots used for measuring every circuit.", type=float
)
parser.add_argument(
    "--post_selection", default=True, help="Post selection technique", type=bool
)
parser.add_argument("--no_plot", action="store_true", help="Avoid plots")
def main(N, p, shots, post_selection, no_plot):
    # Initialize exact and measured tangles
    tangles = np.empty(N)
    opt_tangles = np.empty(N)
    circuit = ansatz(p)
    for qubit in range(N):
        """
        For every seed from 0 to N, the steps to follow are
        1) A random state with three qubits is created from the seed
        2) The tangle of the recently created random state is computed exactly
        3) Transformation to the up-to-phases canonical form is performed by applying local operations
                that drive some coefficients to zero
        4) The tangle of the up-to-phases canonical form of the created state is measured from the outcomes of the state.
                Post-selection can be applied at this stage
        Results are stored into variables to paint the results
        """
        if qubit % 10 == 0:
            print("Initialized state with seed %s" % qubit + "/ %s" % N)
        state = create_random_state(qubit, p > 0)
        tangles[qubit] = compute_random_tangle(qubit)
        _, params = canonize(state, circuit, shots=np.int32(shots))
        opt_tangles[qubit] = canonical_tangle(
            state, params, circuit, post_selection=post_selection
        )
Main (examples/aavqe/main.py)
#!/usr/bin/env python
import argparse
import numpy as np
from qibo import Circuit, gates
from qibo.hamiltonians import XXZ, X
from qibo.models.variational import AAVQE
def main(nqubits, layers, maxsteps, T_max):
    circuit = Circuit(nqubits)
    for l in range(layers):
        circuit.add(gates.RY(q, theta=0) for q in range(nqubits))
        circuit.add(gates.CZ(q, q + 1) for q in range(0, nqubits - 1, 2))
        circuit.add(gates.RY(q, theta=0) for q in range(nqubits))
        circuit.add(gates.CZ(q, q + 1) for q in range(1, nqubits - 2, 2))
        circuit.add(gates.CZ(0, nqubits - 1))
    circuit.add(gates.RY(q, theta=0) for q in range(nqubits))
    problem_hamiltonian = XXZ(nqubits)
    easy_hamiltonian = X(nqubits)
    s = lambda t: t
    aavqe = AAVQE(
        circuit, easy_hamiltonian, problem_hamiltonian, s, nsteps=maxsteps, t_max=T_max
    )
    initial_parameters = np.random.uniform(
        0, 2 * np.pi * 0.1, 2 * nqubits * layers + nqubits
    )
    best, params = aavqe.minimize(initial_parameters)
    print("Final parameters: ", params)
    print("Final energy: ", best)
    # We compute the difference from the exact value to check performance
    eigenvalue = problem_hamiltonian.eigenvalues()
    print(eigenvalue)
    print("Difference from exact value: ", best - np.real(eigenvalue[0]))
    print("Log difference: ", -np.log10(best - np.real(eigenvalue[0])))
if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--nqubits", default=6, type=int)
    parser.add_argument("--layers", default=5, type=int)
    parser.add_argument("--maxsteps", default=10, type=int)
    parser.add_argument("--T_max", default=5, type=int)
    args = parser.parse_args()
    main(**vars(args))

Plays well with

License

Apache-2.0

SPDX identifier detected from the repository metadata or license files.

Repository README

Preview from the project README.

Rendered as Markdown inside a scrollable preview. Long READMEs stay contained; expand or open on GitHub for the full document.

~385 words · about 2 min readOpen on GitHub

Logo

codecov

Qibo is an open-source full stack API for quantum simulation and quantum hardware control.

Some of the key features of Qibo are:

  • Definition of a standard language for the construction and execution of quantum circuits with device agnostic approach to simulation and quantum hardware control based on plug and play backend drivers.
  • A continuously growing code-base of quantum algorithms applications presented with examples and tutorials.
  • Efficient simulation backends with GPU, multi-GPU and CPU with multi-threading support.
  • Simple mechanism for the implementation of new simulation and hardware backend drivers.

Documentation

docs

Qibo documentation is available here.

Minimum Working Examples

A simple Quantum Fourier Transform (QFT) example to test your installation:

from qibo.models import QFT

# Create a QFT circuit with 15 qubits
circuit = QFT(15)

# Simulate final state wavefunction default initial state is |00>
final_state = circuit()

Here another example with more gates and shots simulation:

import numpy as np
from qibo import Circuit, gates

circuit = Circuit(2)
circuit.add(gates.X(0))

# Add a measurement register on both qubits
circuit.add(gates.M(0, 1))

# Execute the circuit with the default initial state |00>.
result = circuit(nshots=100)

In both cases, the simulation will run in a single device CPU or GPU in double precision complex128.

Citation policy

DOI

If you use the package please refer to the documentation for citation instructions.

Contacts

To get in touch with the community and the developers, consider joining the Qibo workspace on Matrix:

If you have a question about the project, please contact us with 📫.

Supporters

Financial Sponsors and Development Partners

Collaborators

  • Università degli Studi di Milano (UNIMI), Italy.
  • Università degli Studi di Milano-Bicocca (UNIMIB), Italy.
  • European Organization for Nuclear research (CERN), Switzerland.
  • Universitat de Barcelona (UB), Spain.
  • Barcelona Supercomputing Center (BSC), Spain.
  • Qilimanjaro Quantum Tech, Spain.
  • Centre for Quantum Technologies (CQT), Singapore.
  • Institute of High Performance Computing (IHPC), Singapore.
  • National Supercomputing Centre (NSCC), Singapore.
  • RIKEN Center for Computational Science (R-CCS), Japan.
  • NVIDIA (cuQuantum & cuda-quantum), USA.
Read on GitHub

Activity

Latest release

—

Watchers

32

Python support

—

Learn digest

Get monthly updates when library entries change.

Monthly digest: new library entries, updated flagships, and one editorial pick.

Related resources

Keep exploring nearby tools.

quantumlib

Cirq

Python framework for creating, editing, and running Noisy Intermediate-Scale Quantum (NISQ) circuits.

PythonApache-2.0Flagship

4,971 stars · Updated 3mo ago

XanaduAI

pennylane

PennyLane is an open-source quantum software platform for quantum computing, quantum machine learning, and quantum chemistry.

PythonApache-2.0FlagshipQtangl relevant

3,229 stars · Updated 3mo ago

QISKit

qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

PythonApache-2.0FlagshipQtangl relevant

7,412 stars · Updated 3mo ago

Qiskit

qiskit-terra

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

PythonApache-2.0

7,412 stars · Updated 3mo ago

Microsoft

QuantumKatas

Tutorials and programming exercises for learning Q# and quantum computing

Jupyter NotebookMITFlagshipArchive

4,862 stars · Updated 2y ago

QuantumBFS

Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.

JuliaApache-2.0Flagship

1,032 stars · Updated 3mo ago