A library for efficient similarity search and clustering of dense vectors.
Project description
faiss-wheels
This repository is based on kyamagu/faiss-wheels.
Overview
This repository provides scripts to build GPU-enabled wheels for the faiss library.
Distributes faiss-gpu-cuXX packages to PyPI using the contents of this repository.
Key Features
- No local CUDA installation required - Dynamically links to CUDA Runtime and cuBLAS libraries from PyPI
- Builds CUDA 11.8+ and CUDA 12.1+ compatible wheels
- Supports Volta to Ada Lovelace architecture GPUs (Compute Capability 7.0–8.9)
- Bundles OpenBLAS in Linux
- Reduces wheel file size through dynamic linking instead of static compilation
Important Requirements
The published faiss-gpu-cuXX packages require proper system setup that cannot be managed by pip. It is your responsibility to prepare a suitable environment:
-
NVIDIA Driver: Your host must have a CUDA-compatible NVIDIA driver installed
- The minimum driver version depends on the CUDA version that gets installed
- NVIDIA drivers are backward compatible with older CUDA versions (See CUDA Compatibility Documentation)
-
GPU Architecture: Your GPU must be compatible (Compute Capability 7.0–8.9)
- Supported: Volta, Turing, Ampere, Ada Lovelace
-
Library Compatibility: If you install multiple CUDA-dependent libraries (e.g., PyTorch) in the same environment, they must link to the same CUDA version
GPU Architecture Support for PyPI Packages
Support Policy for faiss-gpu-cu11 and faiss-gpu-cu12
Note: This is an unofficial, personal development project with limited computational resources. Due to these constraints, comprehensive testing across all NVIDIA GPU architectures is not feasible. The pre-built faiss-gpu-cu11 and faiss-gpu-cu12 packages on PyPI aim to support the same GPU architecture range (Compute Capability 7.0–8.9) as the official Faiss repository.
Sponsoring New GPU Architecture Support
Adding support for a new GPU architecture (e.g., Hopper, Blackwell) requires dedicated hardware for building and testing. NVIDIA GPUs have limited compatibility across compute capabilities — binaries built for one architecture do not necessarily work correctly on another. Distributing untested wheels is not an option.
This is an unfunded personal project. If you or your organization need support for an architecture outside the current range, please consider sponsoring this project to help cover the hardware and infrastructure costs. For ongoing discussion and status updates, see Support for New GPU Architectures.
For Unsupported GPU Architectures
If you have a GPU architecture that is not supported by these pre-built wheels:
- Official Faiss: Follow the official Faiss repository build instructions
- Build from Source: Use this repository's code to build wheels for your specific architecture (see Building from Source section)
Installation
The faiss-gpu-cu11 and faiss-gpu-cu12 wheels are available on PyPI. Choose the appropriate version for your CUDA environment.
For CUDA 12
# Install with fixed CUDA 12.1 (requires NVIDIA Driver ≥R530)
pip install 'faiss-gpu-cu12[fix-cuda]'
# Install with CUDA 12.X (X≥1) - allows flexibility but driver requirement varies
pip install faiss-gpu-cu12
Details:
faiss-gpu-cu12is built with CUDA Toolkit 12.1 and maintains minor version compatibility- With
[fix-cuda]: Installs exactly CUDA 12.1, requiring NVIDIA Driver ≥R530 - Without
[fix-cuda]: Allows any CUDA 12.X (X≥1), driver requirement depends on the actual CUDA version installed- For example: CUDA 12.4 requires Driver ≥R550
- Use without
[fix-cuda]when integrating with other CUDA-dependent packages (e.g., PyTorch with CUDA 12.4)
System Requirements:
- OS: Linux x86_64 (glibc ≥2.17)
- GPU: Compute Capability 7.0–8.9
For CUDA 11
# Install with CUDA 11.8 (requires NVIDIA Driver ≥R520)
pip install faiss-gpu-cu11[fix-cuda]
# Same as above (CUDA 11.8 is the final version)
pip install faiss-gpu-cu11
Details:
faiss-gpu-cu11is built with CUDA Toolkit 11.8- Both commands install CUDA 11.8 since no newer CUDA 11.X versions exist
- Requires NVIDIA Driver ≥R520
System Requirements:
- OS: Linux x86_64 (glibc ≥2.17)
- GPU: Compute Capability 7.0–8.9
Driver Compatibility Reference
| CUDA Version | Minimum Driver Version |
|---|---|
| CUDA 11.8 | ≥R520 (520.61.05) |
| CUDA 12.1 | ≥R530 (530.30.02) |
| CUDA 12.2+ | Check NVIDIA Documentation |
Warning: When installing without [fix-cuda], pip may resolve to a newer CUDA version that requires a newer driver than you have installed. Always verify driver compatibility before installation.
Advanced: Using System CUDA Libraries
If you need to use system-installed CUDA instead of PyPI CUDA packages, you can bypass the automatic CUDA loading:
- Exclude PyPI CUDA dependencies using your package manager (e.g., uv, pdm)
- Set environment variable:
_FAISS_WHEEL_DISABLE_CUDA_PRELOAD=1 - Ensure CUDA libraries are accessible via
LD_LIBRARY_PATH
Example with uv (workaround):
# In pyproject.toml
[tool.uv]
override-dependencies = [
"nvidia-cuda-runtime-cu11==0.0.0; sys_platform == 'never'",
"nvidia-cublas-cu11==0.0.0; sys_platform == 'never'",
]
Versioning
- Follows the original faiss repository versioning (e.g.,
1.11.0) - Patches specific to this repository use
postNsuffix (e.g.,1.11.0.post1)
Building from Source
Build faiss-gpu-cu11 and faiss-gpu-cu12 wheels using cibuildwheel.
Build Configuration
# Configure build parameters
export NJOB="32" # Number of parallel build jobs
export FAISS_OPT_LEVEL="generic" # Options: generic, avx2, avx512
export CUDA_ARCHITECTURES="70-real;80-real" # Target GPU architectures
# For builds without GPU testing
export CIBW_TEST_COMMAND_LINUX=""
# For builds with GPU testing (requires NVIDIA Docker)
export CIBW_CONTAINER_ENGINE='docker; create_args: --gpus all'
# Note: GPU testing requires Docker with NVIDIA Container Toolkit configured
Build Commands
# Build faiss-gpu-cu11 wheels
uvx cibuildwheel@2.23.2 variant/gpu-cu11 --output-dir wheelhouse/gpu-cu11
# Build faiss-gpu-cu12 wheels
uvx cibuildwheel@2.23.2 variant/gpu-cu12 --output-dir wheelhouse/gpu-cu12
Wheels will be created in {repository_root}/wheelhouse/gpu-cuXX/.
Build Requirements
- OS: Linux x86_64
- NVIDIA Container Toolkit (if running tests)
- NVIDIA Driver: ≥R530 (if running tests with CUDA 12)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file faiss_gpu_cu11-1.14.1.post1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: faiss_gpu_cu11-1.14.1.post1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 48.4 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18babd7672bbc33181bc025609cfa0684af574ed9c2e8a8ee5405be9e1a77fef
|
|
| MD5 |
e1e51a912fa5b699b342f6ababeced50
|
|
| BLAKE2b-256 |
8a1d781267d1f54fabce2df1a4a7a74d70c582dd767c024f6ee170187cb50ba6
|
Provenance
The following attestation bundles were made for faiss_gpu_cu11-1.14.1.post1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_wheel.yml on Di-Is/faiss-gpu-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
faiss_gpu_cu11-1.14.1.post1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
18babd7672bbc33181bc025609cfa0684af574ed9c2e8a8ee5405be9e1a77fef - Sigstore transparency entry: 1053601852
- Sigstore integration time:
-
Permalink:
Di-Is/faiss-gpu-wheels@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Branch / Tag:
refs/tags/v1.14.1.post1 - Owner: https://github.com/Di-Is
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheel.yml@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Trigger Event:
release
-
Statement type:
File details
Details for the file faiss_gpu_cu11-1.14.1.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: faiss_gpu_cu11-1.14.1.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 48.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6d9397b0328b5cbf5c8ebbf933a7997b9bf4b80ef41c45d85c1c37587e32200
|
|
| MD5 |
5c75cb0a26f854d5c3eb7927a357df73
|
|
| BLAKE2b-256 |
1469d4d89bce61bf8f32b725492652c8bcad647a3104d7c28889d12eb5a50ce6
|
Provenance
The following attestation bundles were made for faiss_gpu_cu11-1.14.1.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_wheel.yml on Di-Is/faiss-gpu-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
faiss_gpu_cu11-1.14.1.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
a6d9397b0328b5cbf5c8ebbf933a7997b9bf4b80ef41c45d85c1c37587e32200 - Sigstore transparency entry: 1053601606
- Sigstore integration time:
-
Permalink:
Di-Is/faiss-gpu-wheels@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Branch / Tag:
refs/tags/v1.14.1.post1 - Owner: https://github.com/Di-Is
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheel.yml@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Trigger Event:
release
-
Statement type:
File details
Details for the file faiss_gpu_cu11-1.14.1.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: faiss_gpu_cu11-1.14.1.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 48.3 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31c5f3b7b307f5c5565188383190905f6cd79f344888a190249fad2c72d199b4
|
|
| MD5 |
f6e9ff7e5c026f47ccddb762c19348ed
|
|
| BLAKE2b-256 |
22a8925a4fb7b6df51d368d63e48bb0db0b07cca4f941153543ce526bee05ac7
|
Provenance
The following attestation bundles were made for faiss_gpu_cu11-1.14.1.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_wheel.yml on Di-Is/faiss-gpu-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
faiss_gpu_cu11-1.14.1.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
31c5f3b7b307f5c5565188383190905f6cd79f344888a190249fad2c72d199b4 - Sigstore transparency entry: 1053601528
- Sigstore integration time:
-
Permalink:
Di-Is/faiss-gpu-wheels@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Branch / Tag:
refs/tags/v1.14.1.post1 - Owner: https://github.com/Di-Is
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheel.yml@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Trigger Event:
release
-
Statement type:
File details
Details for the file faiss_gpu_cu11-1.14.1.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: faiss_gpu_cu11-1.14.1.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 48.3 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc8347b624fa8ba8ca8de308a25c6257955a5406d90888edcc9721d7ccf6479d
|
|
| MD5 |
81667fcc1407a13f025fc37c1aadd4f2
|
|
| BLAKE2b-256 |
85b2c2ee308eb65b77b883fc0a337ac020618020b39f963c703f32189e37e021
|
Provenance
The following attestation bundles were made for faiss_gpu_cu11-1.14.1.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_wheel.yml on Di-Is/faiss-gpu-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
faiss_gpu_cu11-1.14.1.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
bc8347b624fa8ba8ca8de308a25c6257955a5406d90888edcc9721d7ccf6479d - Sigstore transparency entry: 1053601973
- Sigstore integration time:
-
Permalink:
Di-Is/faiss-gpu-wheels@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Branch / Tag:
refs/tags/v1.14.1.post1 - Owner: https://github.com/Di-Is
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheel.yml@3d85d162e7e9820abe3230f27ec067fd7d6d327f -
Trigger Event:
release
-
Statement type: