RapidFuzz: Rapid fuzzy string matching in Python

raw JSON →
3.14.3 verified Tue May 12 auth: no python install: verified quickstart: verified

RapidFuzz is a high-performance Python library for rapid fuzzy string matching, utilizing various string metrics. The current version is 3.14.3, released on March 28, 2026. It is actively maintained with regular updates to improve performance and functionality.

pip install rapidfuzz
error error: Microsoft Visual C++ 14.0 or greater is required
cause RapidFuzz is a C++ extension that requires a compatible C++ compiler (like MSVC on Windows) to be installed on your system for pip to compile it during installation.
fix
Install the 'Build Tools for Visual Studio' (for Windows) and ensure the 'Desktop development with C++' workload is selected. On Linux/macOS, ensure development tools like build-essential (Debian/Ubuntu) or Xcode Command Line Tools (macOS) are installed.
error ModuleNotFoundError: No module named 'rapidfuzz'
cause The rapidfuzz library has not been installed in your current Python environment, or the environment where it's installed is not active.
fix
Install the library using pip: pip install rapidfuzz
error AttributeError: module 'rapidfuzz' has no attribute 'ratio'
cause The `ratio` function (and other fuzzy string metrics) are located within the `rapidfuzz.fuzz` submodule, not directly under the top-level `rapidfuzz` module.
fix
Import ratio from rapidfuzz.fuzz or import fuzz and access it as fuzz.ratio:
from rapidfuzz.fuzz import ratio
ratio("apple", "appel")
# OR
from rapidfuzz import fuzz
fuzz.ratio("apple", "appel")
error AttributeError: module 'rapidfuzz.fuzz' has no attribute 'extract'
cause The `extract` function, used for extracting best matches from a list of choices, is located in the `rapidfuzz.process` submodule, not `rapidfuzz.fuzz`.
fix
Import extract from rapidfuzz.process:
from rapidfuzz import process
process.extract("apple", ["orange", "apple pie", "banana"])
breaking Starting from version 3.0.0, RapidFuzz no longer preprocesses strings by default (e.g., removing non-alphanumeric characters, trimming whitespaces, converting to lowercase). This change may affect similarity scores when comparing strings with different cases or punctuation. To enable preprocessing, use the 'processor' parameter with 'utils.default_process'.
fix Use the 'processor' parameter with 'utils.default_process' to enable preprocessing.
gotcha Ensure that the 'numpy' package is installed, as RapidFuzz relies on it for efficient numerical computations. If 'numpy' is not installed, you may encounter import errors or performance issues.
fix Install 'numpy' using 'pip install numpy'.
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.03s 33.6M
3.10 slim (glibc) - - 0.02s 30M
3.11 alpine (musl) - - 0.06s 35.5M
3.11 slim (glibc) - - 0.04s 32M
3.12 alpine (musl) - - 0.04s 27.4M
3.12 slim (glibc) - - 0.03s 24M
3.13 alpine (musl) - - 0.04s 27.0M
3.13 slim (glibc) - - 0.04s 24M
3.9 alpine (musl) - - 0.03s 33.4M
3.9 slim (glibc) - - 0.03s 29M

A simple example demonstrating how to use RapidFuzz to compare two strings and calculate their similarity ratio.

from rapidfuzz import fuzz

# Compare two strings
string1 = 'hello world'
string2 = 'helo world'

# Calculate similarity ratio
similarity = fuzz.ratio(string1, string2)
print(f'Similarity: {similarity}%')