Registry / ai-ml / dwave-ocean-sdk

dwave-ocean-sdk

JSON →
library9.3.0pypypi✓ verified 85d ago

The D-Wave Ocean SDK provides a set of open-source Python tools for solving combinatorial optimization problems on D-Wave quantum computers and quantum-hybrid solvers. The current version is 9.3.0, with a required Python version >=3.10. The SDK is actively maintained with releases roughly quarterly.

pip install dwave-ocean-sdk
INSTALL
IMPORT
SIG · DWAVE-OCEAN-SDK
D
dwave-ocean-sdk
ai-mlpythonv9.3.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.

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}")
Debug
Known issues
gotchaThe dwave-ocean-sdk installs many packages but may have pinning conflicts. Use a virtual environment to avoid issues with existing dimod or neal versions.
fix
Always create a fresh virtual environment before installing dwave-ocean-sdk.
affects: >=9.0
breakingStarting from version 7.0, the package no longer supports Python 3.7 and 3.8. Python 3.9 support was dropped in version 9.0.
fix
Ensure your Python version is 3.10 or above. Upgrade pip and check Python version with 'python --version'.
affects: >=9.0
gotchaThe default 'base' endpoint in DWaveSampler points to the D-Wave QPU, which requires a valid token. For hybrid solvers, use LeapHybridSampler instead.
fix
If you don't have a QPU token, use LeapHybridSampler (solved via the hybrid solver service) or a classical sampler like Neal's SimulatedAnnealingSampler.
affects: all
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.
fix
Import 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.
fix
Set 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).
fix
Verify 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.
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
dwave-ocean-sdk — pip install dwave-ocean-sdk · libregistry