Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DWaveSampler
✓ from dwave.system import DWaveSampler
✗ from dwave_sapi import DWaveSampler
The old import path is from an older SDK version.
EmbeddingComposite
✓ from dwave.system.composites import EmbeddingComposite
Used to automatically embed problems onto the QPU topology.
dimod
✓ import dimod
✗ from dwave import dimod
dimod is a separate package, not a submodule of dwave.
LeapHybridSampler
✓ from dwave.system import LeapHybridSampler
✗ from dwave.leap import HybridSampler
LeapHybridSampler is in dwave.system, not a separate dwave.leap module.
Sets up a BQM, connects to a D-Wave sampler (with token), and solves a simple QUBO problem.
import os
import dimod
from dwave.system import DWaveSampler, EmbeddingComposite
# Set your API token (replace with your actual token or use env variable)
token = os.environ.get('DWAVE_API_TOKEN', '')
# Define a simple QUBO problem
Q = {('a','a'): -1, ('b','b'): -1, ('a','b'): 2}
bqm = dimod.BQM.from_qubo(Q, dimod.BINARY)
# Solve on a D-Wave sampler (requires token)
try:
sampler = EmbeddingComposite(DWaveSampler(token=token))
sampleset = sampler.sample(bqm, num_reads=100)
print(sampleset.first.sample)
except Exception as e:
print(f"Error: {e}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dwave'
The top-level package name is not 'dwave'; the SDK installs multiple packages like 'dimod', 'dwave-system', etc.
fixImport specific modules: 'import dimod', 'from dwave.system import DWaveSampler', etc.
KeyError: 'DWAVE_API_TOKEN'
The API token environment variable is not set when using DWaveSampler() without token argument.
fixSet the environment variable: export DWAVE_API_TOKEN='your-token' or pass token='your-token' to DWaveSampler.
ValueError: Invalid solver. No solver matched the specified criteria.
DWaveSampler could not find a solver matching the default criteria (usually due to missing token or wrong endpoint).
fixVerify your API token is valid and you have access to at least one solver. Alternatively, use LeapHybridSampler for hybrid access.
Upgrade
Version history
9.3.0latest on PyPI · released Jan 22, 2026
Audit
Dependencies
dimodrequiredCore shared binary object representation for QUBO/Ising models.
dwave-systemrequiredProvides access to D-Wave solvers (including Leap hybrid solvers).
dwave-nealoptionalSimulated annealing sampler.
dwave-tabuoptionalTabu search sampler.
dwave-greedyoptionalGreedy algorithms for small problems.