faiss-gpu-cu12 is a Python library for efficient similarity search and clustering of dense vectors, leveraging NVIDIA GPUs with CUDA 12. It provides pre-built wheels that dynamically link to CUDA Runtime and cuBLAS libraries available on PyPI, eliminating the need for a local CUDA installation. This particular package is an unofficial, community-maintained build, offering specialized support for CUDA 12.1 and maintaining minor version compatibility. The current version is 1.14.1.post1, with a release cadence tied to updates in the underlying Faiss library and CUDA versions.
pip install faiss-gpu-cu12Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a simple Faiss index on the CPU, populate it with random data, then move it to an available GPU for accelerated similarity search. It includes a fallback to CPU search in case of GPU environment issues.
Ensure your system has an up-to-date NVIDIA driver (R530+ for CUDA 12.1, R550+ for CUDA 12.4) and a supported GPU. Refer to NVIDIA's CUDA compatibility documentation for details.
Use `pip install 'faiss-gpu-cu12[fix-cuda]'` to enforce CUDA 12.1 explicitly. Carefully manage your environment dependencies or use isolated environments (e.g., conda, virtualenv) for different CUDA-dependent projects.
Be aware of potential edge cases or lack of support for very new or niche hardware. For critical enterprise applications, consider contributing to the project, building Faiss from source with official instructions, or using official distributions if available.
If using H100/Hopper GPUs, avoid `faiss-gpu-cu12==1.13.2`. Check the project's GitHub releases or issues for newer versions that explicitly include `sm_90` kernels, or consider building Faiss from source with `sm_90` support enabled.
Install the correct `faiss-gpu-cu12` package using pip: `pip install faiss-gpu-cu12`.
Specify the correct package name for the CUDA 12 GPU version: `pip install faiss-gpu-cu12`.
Reduce the batch size, decrease the vector dimension, free up GPU memory by clearing caches (e.g., `torch.cuda.empty_cache()` if using PyTorch alongside), or use a GPU with more VRAM.
Check the supported compute capabilities of the installed `faiss-gpu-cu12` version against your GPU's compute capability. If unsupported, you may need to compile Faiss from source with your GPU's architecture specified, or downgrade to an older GPU if possible.