{"id":24618,"library":"spconv-cu126","title":"spconv (CUDA 12.6)","description":"Spatial sparse convolution library for PyTorch, optimized for 3D point cloud processing. Version 2.3.8 supports CUDA 12.6 and Python >=3.9. Release cadence is irregular, with major version bumps coinciding with PyTorch/CUDA version support.","status":"active","version":"2.3.8","language":"python","source_language":"en","source_url":"https://github.com/traveller59/spconv","tags":["sparse convolution","3d","point cloud","cuda","pytorch"],"install":[{"cmd":"pip install spconv-cu126","lang":"bash","label":"Install for CUDA 12.6"}],"dependencies":[{"reason":"Runtime dependency; spconv builds on PyTorch tensors and CUDA.","package":"torch","optional":false}],"imports":[{"note":"Primary sparse convolution layer.","symbol":"SparseConv3d","correct":"from spconv import SparseConv3d"},{"note":"Wrapper for sequential sparse modules.","symbol":"SparseSequential","correct":"from spconv import SparseSequential"},{"note":"Core sparse tensor format.","symbol":"SparseConvTensor","correct":"from spconv import SparseConvTensor"}],"quickstart":{"code":"import torch\nfrom spconv import SparseConv3d, SparseSequential, SparseConvTensor\n\n# Create a sparse tensor (batch_size=1, channels=4, depth=10, height=10, width=10)\ncoords = torch.randint(0, 10, (100, 4)).int()  # (n_points, 4) -> batch_idx, x, y, z\ncoords[:, 0] = 0  # batch index 0\nfeatures = torch.randn(100, 4)\ntensor = SparseConvTensor(features, coords, spatial_shape=(10, 10, 10), batch_size=1)\n\n# Define a simple sparse 3D convolutional network\nmodel = SparseSequential(\n    SparseConv3d(4, 8, kernel_size=3, padding=1),\n    SparseConv3d(8, 16, kernel_size=3, padding=1),\n)\n\n# Forward pass\noutput = model(tensor)\nprint(output.features.shape)  # torch.Size([100, 16])","lang":"python","description":"Minimal example constructing a SparseConvTensor and passing it through a sparse CNN."},"warnings":[{"fix":"Port code from v1.x patterns (e.g., SparseConv3d import path changed from spconv.conv to spconv).","message":"spconv v2.x is not compatible with spconv v1.x; the API and internal data structures changed completely.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Match the CUDA major version of your PyTorch installation. Check with: torch.version.cuda","message":"The library provides separate wheels for each CUDA version (e.g., spconv-cu118, spconv-cu121, spconv-cu126). Installing the wrong wheel may cause CUDA runtime errors.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Ensure coordinates tensor is .int() (int32) before passing to SparseConvTensor.","message":"SparseConvTensor indices must be integer tensors of type torch.int32 (or convertible). Using torch.int64 may silently fail or throw 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":"Uninstall spconv and install the correct wheel for your CUDA version (e.g., for CUDA 12.1: pip install spconv-cu121).","cause":"Mismatch between CUDA version of installed spconv wheel and the actual CUDA toolkit/driver.","error":"RuntimeError: CUDA error: no kernel image is available for execution on the device"},{"fix":"Use: from spconv import SparseConv3d","cause":"Using old import path from spconv v1.x. In v2.x the module layout changed.","error":"ImportError: cannot import name 'SparseConv3d' from 'spconv'"},{"fix":"Ensure features.shape[0] == coords.shape[0].","cause":"Number of points in coordinates tensor (first dimension) does not match features tensor first dimension.","error":"AssertionError: The shape of features and coordinates must match"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}