Install & Compatibility
Where this runs
tested against v3.1.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 21MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Initialize a stemmer for a specific language and use it to stem single words or lists of words. It's recommended to reuse the stemmer object for performance due to caching.
import Stemmer
# Get a list of available algorithms
algorithms = Stemmer.algorithms()
# print(algorithms) # Uncomment to see the list
# Get an instance of the English stemmer
stemmer = Stemmer.Stemmer('english')
# Stem a single word
word = 'cycling'
stemmed_word = stemmer.stemWord(word)
print(f"'{word}' stemmed to: '{stemmed_word}'")
# Stem a list of words
words = ['connection', 'connections', 'connective', 'connected', 'connecting']
stemmed_words = stemmer.stemWords(words)
print(f"Words {words} stemmed to: {stemmed_words}")
Debug
Known issues
gotchaStemmer objects are not thread-safe if used concurrently by multiple threads. Race conditions can occur.fixCreate a new `Stemmer.Stemmer()` object for each thread or protect access to a shared stemmer object with a mutex (e.g., `threading.Lock`).
affects: All versions
gotchaInstalling PyStemmer might fail if pre-built wheels are not available for your system and Python version, as it requires a C compiler and Python development header files to build from source.fixEnsure you have a C compiler (e.g., GCC, Clang) and Python development headers installed on your system. For Debian/Ubuntu: `sudo apt-get install build-essential python3-dev`.
affects: All versions, particularly on less common architectures or specific Python versions
breakingPython 2 is no longer actively supported. PyStemmer 2.2.0.1 was the final version tested with Python 2.fixUpgrade to Python 3.8+ and PyStemmer 3.0.0 or newer. Earlier versions of PyStemmer supporting Python 3 are also available for older Python 3 environments.
affects: < 3.0.0
gotchaInput strings are assumed to be Unicode. While `stemWords` can accept UTF-8 encoded byte strings, inconsistencies with other encodings or incorrect handling of Unicode can lead to unexpected stemming results.fixEnsure all input text is consistently handled as Unicode strings before passing it to PyStemmer. Explicitly decode byte strings if their encoding is known and not UTF-8.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'Stemmer'
The `pystemmer` library, which exposes the `Stemmer` module, is either not installed in the current Python environment or the environment is not active.
Failed building wheel for pystemmer
This generic installation error typically indicates missing C compiler tools or Python development headers required to compile the underlying `libstemmer_c` C extension.
fixOn Debian/Ubuntu: `sudo apt-get install build-essential python3-dev`. On macOS: `xcode-select --install`. On Windows: Install 'Build Tools for Visual Studio' with the 'Desktop development with C++' workload from Microsoft.
AttributeError: module 'pystemmer' has no attribute 'Stemmer'
The `pystemmer` package, when imported directly as `pystemmer`, does not expose the `Stemmer` class. The main module containing the class is simply named `Stemmer`.
TypeError: Stemmer.Stemmer() takes 1 positional argument but 0 were given
The `Stemmer` class constructor requires a string argument specifying the language (e.g., `'english'`) to initialize the stemmer.
fixs = Stemmer.Stemmer('english') # Replace 'english' with your desired language Upgrade
Version history
3.1.0latest on PyPI · released May 22, 2026
Audit
Dependencies
libstemmer_crequiredPyStemmer is a wrapper around the C implementation of Snowball stemmers for performance.
C compileroptionalRequired for building from source if pre-built wheels are not available.
Python header filesoptionalRequired for building from source if pre-built wheels are not available.