-
Notifications
You must be signed in to change notification settings - Fork 199
Migrating from qsharp to qdk
Scott Carda edited this page May 8, 2026
·
3 revisions
Important
This page's accuracy is pending the merging of PR #3192
The qsharp Python package has been replaced by qdk.
The qsharp package is now a thin compatibility shim. Existing code will continue to work,
but you will see a DeprecationWarning on import. The qsharp package will be removed in a
future release.
Before:
pip install qsharp
pip install "qsharp[qiskit]"After:
pip install qdk
pip install "qdk[qiskit]"The extras have been consolidated and some renamed:
qsharp extra |
qdk extra |
|---|---|
jupyterlab |
jupyter |
widgets |
jupyter |
qiskit |
qiskit |
cirq |
cirq |
qre |
qre |
| (none) | azure |
| (none) | applications |
| (none) | all |
The most common import pattern and the smallest change:
# Before
import qsharp
qsharp.init()
qsharp.eval("Message('Hello')")
result = qsharp.run("{ H(Qubit()); }", shots=10)
# After
import qdk
from qdk import qsharp
qdk.init()
qsharp.eval("Message('Hello')")
result = qsharp.run("{ H(Qubit()); }", shots=10)# Before
from qsharp import Result, Pauli, TargetProfile, QSharpError, StateDump, ShotResult
# After
from qdk import Result, TargetProfile, StateDump, ShotResult
from qdk.qsharp import Pauli, QSharpError# Before
from qsharp import PauliNoise, DepolarizingNoise, BitFlipNoise, PhaseFlipNoise
# After
from qdk import PauliNoise, DepolarizingNoise, BitFlipNoise, PhaseFlipNoise# Before
import qsharp
qsharp.eval("operation MyOp() : Unit { ... }")
qsharp.code.MyOp()
# After
from qdk import qsharp
qsharp.eval("operation MyOp() : Unit { ... }")
import qdk.code
qdk.code.MyOp()# Before
from qsharp.estimator import EstimatorParams, QubitParams, QECScheme
# After
from qdk.estimator import EstimatorParams, QubitParams, QECScheme# Before
from qsharp.openqasm import run, compile, circuit, estimate
# After
from qdk.openqasm import run, compile, circuit, estimate# Before
from qsharp._simulation import run_qir
from qsharp.noisy_simulator import DensityMatrixSimulator, StateVectorSimulator
# After
from qdk.simulation import run_qir, DensityMatrixSimulator, StateVectorSimulator# Before
from qsharp.interop.qiskit import QSharpBackend
# After
from qdk.qiskit import QSharpBackend# Before
from qsharp.interop.cirq import NeutralAtomSampler
# After
from qdk.cirq import NeutralAtomSampler# Before
from qsharp.qre import estimate, Application, Architecture, ISA
# After
from qdk.qre import estimate, Application, Architecture, ISAThe %%qsharp cell magic works automatically with any qdk import:
# Before
import qsharp
# After - any of these will register the %%qsharp magic
import qdk
from qdk import qsharp
from qdk.qre import estimate # any qdk submodule worksBefore (qsharp) |
After (qdk) |
|---|---|
import qsharp |
from qdk import qsharp |
from qsharp import init, run |
from qdk.qsharp import init, run |
from qsharp import Result, TargetProfile |
from qdk import Result, TargetProfile |
from qsharp.estimator import ... |
from qdk.estimator import ... |
from qsharp.openqasm import ... |
from qdk.openqasm import ... |
from qsharp.interop.qiskit import ... |
from qdk.qiskit import ... |
from qsharp.interop.cirq import ... |
from qdk.cirq import ... |
from qsharp.noisy_simulator import ... |
from qdk.simulation import ... |
from qsharp.qre import ... |
from qdk.qre import ... |
from qsharp.applications import ... |
from qdk.applications import ... |
qsharp.code.MyOp |
qdk.code.MyOp |
pip install "qsharp[qiskit]" |
pip install "qdk[qiskit]" |
Q# Wiki
Overview
Q# language & features
- Q# Structs
- Q# External Dependencies (Libraries)
- Differences from the previous QDK
- V1.3 features
- Curated list of Q# libraries
- Advanced Topics and Configuration
- QDK Profile Selection
OpenQASM support
VS Code
Python
- Invoking Q# callables from Python
- Working with Jupyter Notebooks
- Qiskit Interop
- Windows on ARM64
- QDK Python Simulators
Circuit diagrams
Azure Quantum
For contributors