{"id":23480,"library":"cutensornet-cu12","title":"cuTensorNet (cu12)","description":"cuTensorNet is a component of NVIDIA cuQuantum SDK for tensor network computations, enabling efficient contraction of tensor networks on GPUs. This package (cutensornet-cu12) targets CUDA 12.x. Current version: 24.10.0. It is part of the cuQuantum Python ecosystem, maintained by NVIDIA with quarterly releases.","status":"active","version":"24.10.0","language":"python","source_language":"en","source_url":"https://github.com/NVIDIA/cuQuantum","tags":["cuQuantum","tensor network","GPU","NVIDIA","CUDA"],"install":[{"cmd":"pip install cutensornet-cu12","lang":"bash","label":"Install for CUDA 12.x"}],"dependencies":[{"reason":"Provides the higher-level Python API (`cuquantum` module) that wraps cuTensorNet functionality.","package":"cuquantum-python-cu12","optional":false},{"reason":"Most examples use CuPy as a GPU array backend for tensor data.","package":"cupy-cuda12x","optional":true}],"imports":[{"note":"The high-level API is in the `cuquantum` package, not directly in `cutensornet`.","wrong":"from cutensornet import NetworkOperator","symbol":"NetworkOperator","correct":"from cuquantum import NetworkOperator"},{"note":"The native cuTensorNet C API is exposed via `cuquantum.cutensornet` but users should prefer the high-level API.","wrong":"from cutensornet.cutensornet import ContractionOptimizer","symbol":"ContractionOptimizer","correct":"from cuquantum import ContractionOptimizer"}],"quickstart":{"code":"import cupy as cp\nfrom cuquantum import NetworkOperator, ContractionOptimizer\n\n# Define tensor network\nexpr = 'ij,jk,kl->il'\noperands = [\n    cp.random.rand(2, 3),\n    cp.random.rand(3, 4),\n    cp.random.rand(4, 2)\n]\n\n# Create network operator\nnet = NetworkOperator(expr, *operands)\n\n# Optimize contraction path\noptimizer = ContractionOptimizer(net)\npath, cost = optimizer.optimize()\n\n# Contract\ntn_result = net.contract(path)\nprint(tn_result)","lang":"python","description":"Minimal example: define a tensor network, optimize its contraction path, and contract."},"warnings":[{"fix":"Change imports to `from cuquantum import ...`.","message":"The import path for the main API changed from `cutensornet` to `cuquantum` starting in version 22.x. Code using `import cutensornet` will break.","severity":"breaking","affected_versions":"<=21.x"},{"fix":"Install both: `pip install cutensornet-cu12 cuquantum-python-cu12`.","message":"The `cutensornet-cu12` PyPI package only provides the C/CUDA native library. The Python bindings are in `cuquantum-python-cu12`. Installing only `cutensornet-cu12` is insufficient; you must also install `cuquantum-python-cu12`.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `cutensornet.contract(...)` with `NetworkOperator` and `ContractionOptimizer`.","message":"The `cuquantum` Python package now recommends using `NetworkOperator` instead of the older `einsum` style interface. The old `cutensornet.contract` function is deprecated.","severity":"deprecated","affected_versions":">=22.03"},{"fix":"Convert NumPy arrays to CuPy arrays before passing to `NetworkOperator`.","message":"Tensor operands must be on the GPU (CuPy or similar). Passing NumPy arrays will raise an error.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install cuquantum-python-cu12`.","cause":"Missing `cuquantum-python-cu12` package (the Python bindings).","error":"ModuleNotFoundError: No module named 'cuquantum'"},{"fix":"Change to `from cuquantum import NetworkOperator`.","cause":"Using wrong import path. The high-level API is in `cuquantum`, not `cutensornet`.","error":"AttributeError: module 'cutensornet' has no attribute 'NetworkOperator'"},{"fix":"Convert NumPy arrays: `cp.asarray(numpy_array)`.","cause":"Tensor operands must be GPU arrays (CuPy).","error":"TypeError: expected cupy.ndarray, got numpy.ndarray"},{"fix":"Check cuQuantum compatibility matrix; ensure GPU compute capability >= 7.0 (Volta).","cause":"Tensor data type or network topology not supported on the current GPU architecture.","error":"cuTensorNet error: CUTENSORNET_STATUS_NOT_SUPPORTED"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}