Registry / data / fuzzywuzzy

fuzzywuzzy

JSON →
library0.18.0pypypi✓ verified 31d ago

FuzzyWuzzy is a Python library that implements fuzzy string matching, often used for comparing the similarity between two strings. It leverages Levenshtein distance to calculate ratios between strings. The current version is 0.18.0. Its release cadence has been infrequent in recent years.

pip install fuzzywuzzy
INSTALL
IMPORT
SIG · FUZZYWUZZY
F
fuzzywuzzy
datapythonv0.18.0
Install
2.2s avg
Import
43ms
Disk
32MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.18.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.046s · 38.3MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 2.2s · import 0.040s · 31MB
32MB installed
● package 32MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fuzz
✓ from fuzzywuzzy import fuzz
process
✓ from fuzzywuzzy import process
✗ from fuzzywuzzy.fuzz import process
The 'process' module, containing functions like extract, is a top-level import, not nested under 'fuzz'.

Demonstrates basic usage of `fuzz` for various ratio calculations and `process` for extracting best matches from a list of choices.

from fuzzywuzzy import fuzz from fuzzywuzzy import process # Simple Ratio print(fuzz.ratio("this is a test", "this is a test!")) # Partial Ratio print(fuzz.partial_ratio("this is a test", "this is a test!")) # Token Sort Ratio print(fuzz.token_sort_ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear")) # Token Set Ratio print(fuzz.token_set_ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear")) choices = ["apple jack", "apple mac", "apple sauce", "orange juice"] print(process.extract("apple", choices, scorer=fuzz.ratio)) print(process.extractOne("apple goop", choices))
Debug
Known issues
gotchaWithout the optional `python-levenshtein` dependency, FuzzyWuzzy can be very slow for large datasets or frequent comparisons. The pure Python implementation is significantly less performant.
fix
Install with `pip install fuzzywuzzy[speedup]` to include the C++ optimized `python-levenshtein` library.
affects: All versions
gotchaFuzzyWuzzy's default string preprocessing (e.g., lowercasing, removing non-alphanumeric characters, and stripping whitespace) can sometimes lead to unexpected results if you need to preserve specific case or punctuation for your matching logic.
fix
Be aware of the `processor` argument in functions like `process.extract` and consider implementing custom preprocessing if the default behavior is not suitable. For `fuzz` functions, you might need to preprocess strings yourself before passing them.
affects: All versions
deprecatedThe library appears to be in a low-maintenance state, with the last release (0.18.0) in 2017. While functional, active development and new features are unlikely.
fix
Consider alternatives like 'thefuzz' (a maintained fork) or 'rapidfuzz' for actively developed and often more performant solutions if long-term support or advanced features are critical.
affects: Since 0.18.0
gotchaWhen using `process.extract` or `process.extractOne`, ensure your `choices` list is not empty, as this can lead to errors or unexpected behavior depending on the FuzzyWuzzy version and specific call.
fix
Always check that the list of choices passed to `process` functions is not empty before making the call.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fuzzywuzzy'
The fuzzywuzzy library is not installed in the Python environment being used, or there's an incompatibility with the Python version (e.g., Python 3.9.4 with older fuzzywuzzy versions).
fix
Ensure fuzzywuzzy is installed in your active Python environment using pip: `pip install fuzzywuzzy` or `pip3 install fuzzywuzzy`. If using Anaconda, try `conda install -c conda-forge fuzzywuzzy` or ensure your Python version is compatible (e.g., use Python 3.8 if experiencing issues with 3.9.4).
AttributeError: module 'fuzzywuzzy' has no attribute 'fuzz'
The `fuzz` submodule, which contains functions like `ratio` and `partial_ratio`, needs to be explicitly imported from the `fuzzywuzzy` package.
fix
Instead of `import fuzzywuzzy` and then `fuzzywuzzy.fuzz.ratio()`, use `from fuzzywuzzy import fuzz` and then `fuzz.ratio()`.
AttributeError: module 'fuzzywuzzy' has no attribute 'process'
Similar to the `fuzz` submodule, the `process` submodule, which contains functions like `extract` and `extractOne`, must be explicitly imported.
fix
Instead of `import fuzzywuzzy` and then `fuzzywuzzy.process.extractOne()`, use `from fuzzywuzzy import process` and then `process.extractOne()`.
UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning.
The optional `python-Levenshtein` library, which provides a significant speedup for fuzzywuzzy, is not installed or not correctly recognized by fuzzywuzzy. This often happens if Microsoft Visual C++ Redistributable is missing on Windows.
fix
Install the `python-Levenshtein` library to enable the faster C implementation: `pip install python-Levenshtein`. On Windows, you might also need to install the Microsoft Visual C++ Redistributable 2015-2022 (x64).
UserWarning: The 'python-Levenshtein' package is not installed, internal Levenshtein implementation will be used which is slower.
'fuzzywuzzy' can use the 'python-Levenshtein' package for significantly faster string matching, but it is an optional dependency and was not found.
fix
pip install python-Levenshtein
Upgrade
Version history
0.18.0latest on PyPI · released Feb 13, 2020
Audit
Dependencies
python-levenshteinoptionalProvides a C++ implementation of Levenshtein distance for significant speed improvements, especially on large datasets.
Agent activity
10 hits · last 30 days
node
10
Resources
fuzzywuzzy — pip install fuzzywuzzy · libregistry