Gates and circuits
Single-qubit, phase, multi-qubit, controlled and rotation gates, plus measurement.

Simulator
AI-Powered Quantum Simulation for Every Scientist — From Circuits to Cosmology in One Interactive Lab. Pakistan’s first AI-powered quantum simulation framework, PKTron is a comprehensive, Python-based platform designed for students, researchers, and engineers. Build, simulate, analyze, and understand quantum systems without the need for real quantum hardware.
From simple 2-qubit circuits to 100-qubit fault-tolerant surface codes, quantum finance models, molecular chemistry simulations, and more, PKTron covers it all — with an AI assistant explaining every step.
PKTron Studio is the visual side of PKTron, available inside QUBO LMS. Build circuits by choosing gates, run them and see the results straight away, without writing code. You can also import and run PKTron code.
Single-qubit, phase, multi-qubit, controlled and rotation gates, plus measurement.
Ready-made Bell, GHZ, QFT, Grover, Teleportation and QAOA circuits.
Statevector, Bloch vectors, entanglement map, density matrix and circuit analytics.
Bell inequality tests and a quantum random number generator.
PKTron v12.0.0 (released 18 September 2026) is the newest version on the Python Package Index (PyPI). Install or upgrade with pip install --upgrade pktron. Requires Python 3.8 or higher.
A new module (pktron/cpbn.py) that adds a stateful computational environment to noise simulation. Gate activity pumps an explicit environmental bath, the bath keeps a configurable memory, relaxes over time, can spread between neighbouring qubits, and feeds back into the noise applied to later gates. So the same gate, reached through a different history, can see different noise.
CPBNConfig and CPBNEnvironment: pumping, memory, saturation and spatial decay you can inspect.run_with_cpbn drives the DensityMatrixSimulator so the bath state really changes the simulated noise.is_cptp helper is included).CPBNNoiseModel adapter for statevector Monte-Carlo trajectory runs.to_safe_json and safe_json_default so NumPy values can be saved to JSON.| Version | Date | Highlights |
|---|---|---|
| 12.0.0 | 18 Sep 2026 | CPBN: computationally pumped bath noise with memory, relaxation and spatial spread; JSON-safe result saving. |
| 11.0.0 | 18 Sep 2026 | Six noise-control features: non-Markovian memory-kernel noise, inverse Kraus synthesis, qutrit leakage with a Leakage Reduction Unit, graph-propagated multi-hop crosstalk, per-mechanism error-budget reports, and adaptive dynamical-decoupling control. |
| 10.0.9 | 11 Sep 2026 | Packaging fix so the PyPI project page shows its full description (follows the 10.0.8 bug-fix release). |
| 10.0.8 | Sep 2026 | Six bug fixes: SurfaceCode(distance=d), QKDPipeline export, Bloch-vector calculation, ADAPT-VQE gradient, GRAPE export, consistent version strings. |
| 9.0.6 | 15 Jul 2026 | PkDag and TranspileStage, CouplingMap and Target, VF2 layout, Clifford+T synthesis, RuntimeExecutor, QPY serialization and more. |
| 9.0.0 | 15 Jun 2026 | Two new systems: NEQ (non-equilibrium simulation engine) and NEF (Noise & Error Free five-layer mitigation pipeline). |
Getting Started (Hello World)
To begin using PKTron, try this example:
from pktron import QuantumCircuit
# Create a 2-qubit circuit (from usage example)
qc = QuantumCircuit(2)
qc.h(0) # Hadamard on qubit 0
qc.cnot(0, 1) # CNOT (control: 0, target: 1)
qc.draw() # Display circuit diagram
100 Circuits to use on PKTRON
Click here to Download 1 to 50
Click here to Download 50 to 100
Working with Visualizations in PKTron
PKTron doesn’t just simulate quantum circuits — it makes them come alive. Watch every gate, qubit, and state evolve in real time with interactive visualizations.
From small 2-qubit circuits to 100-qubit surface codes, PKTron’s visual tools turn abstract quantum concepts into clear, interactive experiments. Perfect for learning, research, and presentations.
Installing PKTRON on Platforms
PKTron is a lightweight Python quantum simulation library available directly from the Python Package Index. It installs easily across all major platforms because it is a pure Python package with minimal dependencies, primarily NumPy.
The standard installation command for any platform is to use pip with the package name pktron. For the most up-to-date version, include the upgrade flag. Always run this command inside an activated virtual environment to avoid conflicts with other Python projects.
Open Command Prompt or PowerShell. It is best to first create and activate a virtual environment using the built-in venv module. Then run the pip installation command. If you encounter permission issues, run the prompt as administrator or use the user flag with pip.
Open the Terminal application. Create and activate a virtual environment with Python three. Then execute the pip installation. macOS usually comes with Python pre-installed, but using a virtual environment ensures isolation.
Open the terminal. Install Python venv and pip if not already present using your distribution’s package manager. Create and activate a virtual environment, then run the pip installation command. On some systems you may need administrator privileges for the initial setup tools.
In any Colab notebook cell, simply run the pip install command prefixed with an exclamation mark. After installation, restart the runtime if prompted, then you can import and use the library immediately. This is one of the fastest ways to get started without local setup.
Inside a notebook cell, use the same exclamation-mark prefixed pip install command. Alternatively, run the pip command from the terminal while the Jupyter environment is active.
Create a new conda environment with a specific Python version such as three point ten. Activate the environment, then use pip to install pktron inside it. This combines conda’s environment management with pip for Python packages.
Clone the repository from its GitHub location using git. Navigate into the cloned folder and install it in editable mode with pip. This approach is useful if you want to modify the source code or access features not yet released on PyPI.
Use Python version three point eight or higher, with three point ten or above recommended for best compatibility. Always upgrade pip itself before installing any package. Virtual environments are strongly advised on every platform to keep projects separate and prevent version conflicts. PKTron has very few dependencies, so the installation process is typically fast and lightweight even on lower-resource machines.
Once installed, open a Python interpreter or notebook and import the main module to check the version. Then create a simple quantum circuit object to confirm everything works without errors. The library supports standard quantum circuit operations right after installation.
If the module is not found after installation, ensure you are running Python in the same environment where you installed the package. Permission errors on Linux or macOS are usually resolved by using a virtual environment instead of system-wide installation. On ARM-based devices such as Raspberry Pi, the package installs normally via pip since wheels are available for common architectures.
PKTron works seamlessly in free online environments like Colab or Kaggle, making it accessible without any local compute power. After successful installation, you can explore its built-in features for circuits, noise simulation, and domain-specific modules such as quantum finance or chemistry.
Documentation
PKTron is a lightweight quantum simulation tool designed for easy access and quick experimentation in quantum computing. It allows users to build and run quantum circuits using familiar Python syntax, making it suitable for beginners, students, educators, and researchers who want to explore quantum concepts without complex setup.
The library supports standard operations such as creating circuits with a chosen number of qubits, applying common single-qubit and multi-qubit gates, performing measurements, and obtaining results like probability distributions or sampled outcomes. Users can work with exact simulations for smaller systems or switch to approximate methods when handling more qubits. Rotation gates accept numerical angles, and there is support for handling variable parameters that can be set later, which is helpful for testing different configurations or running optimization loops.
Noise can be introduced to mimic real hardware behavior through simple error models applied to specific gates during execution. This feature helps in understanding how imperfections affect circuit performance. A convenient executor tool automatically manages the number of repeated runs and returns both raw counts and normalized probabilities, simplifying the process of gathering statistics.
Specialized capabilities extend beyond basic circuits into practical application areas. These include tools tailored for financial modeling such as portfolio selection and risk assessment, biological simulations involving molecular structures or genetic sequences, chemistry calculations for energy levels in small molecules, and even explorations related to large-scale physical phenomena in the early universe. Such integrated features allow direct application of quantum methods to domain-specific problems without needing to assemble everything from scratch.
Performance-oriented options provide faster internal handling for repeated executions or memory-sensitive scenarios, while visualization helpers generate plots of measurement results, state representations, and circuit behaviors. The entire package installs quickly through standard Python tools on Windows, macOS, Linux, or online notebook environments, requiring only a single command and minimal additional libraries.
Overall, PKTron emphasizes immediate usability and broad accessibility, enabling rapid testing of ideas, educational demonstrations, and initial investigations into quantum advantages across different fields. It serves as an entry point for those interested in quantum computing who prefer a straightforward experience focused on outcomes rather than underlying technical details. For further exploration, the official distribution channels provide the package ready for immediate use after installation.
To begin using PKTron, try this example:
from pktron import QuantumCircuit