Registry / ai-ml / dwave-samplers

dwave-samplers

JSON →
library1.7.0pypypi✓ verified 85d ago

Ocean-compatible collection of solvers/samplers for D-Wave quantum annealing and classical simulated annealing. Provides samplers like SimulatedAnnealingSampler, ThermalSampler, TreeDecompositionSolver, and more. Current version 1.7.0, requires Python >=3.10. Released under Apache 2.0.

pip install dwave-samplers
INSTALL
IMPORT
SIG · DWAVE-SAMPLERS
D
dwave-samplers
ai-mlpythonv1.7.0
harness data pending
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.

SimulatedAnnealingSampler
from dwave.samplers import SimulatedAnnealingSampler
from dwave_samplers import SimulatedAnnealingSampler
dwave-samplers is set up as a namespace package under dwave.
ThermalSampler
from dwave.samplers import ThermalSampler
import dwave_samplers
Common mistake: using underscore instead of dot in module path.
TreeDecompositionSolver
from dwave.samplers import TreeDecompositionSolver
from dwave_samplers import TreeDecompositionSolver
Same as above.

Build a Max-Cut problem using Ising formulation and sample with SimulatedAnnealingSampler.

from dwave.samplers import SimulatedAnnealingSampler import dwave_networkx as dnx import networkx as nx # Create a simple graph and solve Max-Cut G = nx.complete_graph(4) sampler = SimulatedAnnealingSampler() result = sampler.sample_ising({}, {edge: 1 for edge in G.edges()}) print(result)
Debug
Known issues
breakingPython 3.9 support removed: requires Python >=3.10 starting from dwave-samplers 1.7.0.
fix
Upgrade to Python 3.10 or later. Use Python 3.9 only with dwave-samplers <1.7.0.
affects: >=1.7.0
gotchaImport path uses dot notation: from dwave.samplers import XXX. The package is a namespace package under dwave, NOT dwave_samplers.
fix
Use from dwave.samplers import <Sampler>; do not use from dwave_samplers import ...
affects: all
deprecatedSome samplers like SteepestDescentSolver are deprecated in favor of other solvers; check release notes for migration.
fix
Refer to official Ocean documentation for current sampler recommendations.
affects: >=1.6.0
gotchaIf dimod is not installed, samplers may fail to import correctly. dwave-samplers depends on dimod for BQM objects.
fix
Install dimod: pip install dimod dwave-samplers
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dwave_samplers'
Incorrect import path using underscore instead of dot.
fix
Use: from dwave.samplers import <sampler_name>
ImportError: cannot import name 'SimulatedAnnealingSampler' from 'dwave.samplers'
Package not installed or version mismatch; namespace package may not be in Python path.
fix
Run: pip install --upgrade dwave-samplers dwave-ocean-sdk
TypeError: sampler.sample() got an unexpected keyword argument 'num_reads'
Some samplers don't accept num_reads; use num_iterations or check docs.
fix
Refer to specific sampler's documentation for accepted parameters.
Upgrade
Version history
1.7.0latest on PyPI · released Oct 28, 2025
Audit
Dependencies
dwave-ocean-sdkrequiredRequired for Ocean integration and utility functions
numpyrequiredNumerical computations
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
dwave-samplers — pip install dwave-samplers · libregistry