Install & Compatibility
Where this runs
tested against v0.7.13 · 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.982s · 44.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.8s · import 0.864s · 46MB
47MB installed
● package 47MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
flesch_reading_ease
✓ from textstat import flesch_reading_ease
✗ from textstat import Text; Text('...').flesch_reading_ease()
The 'Text' class is part of the 1.0.0-alpha pre-release API, not the stable 0.7.x series.
text_standard
✓ from textstat import text_standard
This quickstart demonstrates how to use `textstat` to calculate the Flesch Reading Ease score, determine an approximate readability grade level, and count syllables in a given text. Note that for English (en_US) syllable counting, `nltk` and its 'cmudict' corpus might be required.
import textstat
text = (
"Playing games has always been thought to be important to "
"the development of well-balanced and creative children; "
"however, what part, if any, they should play in the lives "
"of adults has never been researched that deeply. I believe "
"that playing games is every bit as important for adults "
"as for children. Not only is taking time out to play games "
"with our children and other adults valuable to building "
"interpersonal relationships but is also a wonderful way "
"to release built up tension."
)
# Calculate Flesch Reading Ease score
flesch_score = textstat.flesch_reading_ease(text)
print(f"Flesch Reading Ease: {flesch_score}")
# Get the overall readability grade level
grade_level = textstat.text_standard(text)
print(f"Readability Grade Level: {grade_level}")
# Syllable count (may require NLTK cmudict download for en_US)
syllable_count = textstat.syllable_count(text)
print(f"Syllable Count: {syllable_count}")
# If NLTK cmudict is not downloaded for syllable_count:
# import nltk
# nltk.download('cmudict')
Debug
Known issues
breakingThe handling of the CMU Pronouncing Dictionary (`cmudict`) for syllable counting in 'en_US' has changed multiple times between versions 0.7.5 and 0.7.11. While version 0.7.13 defaults to `nltk.corpus.cmudict`, prior versions used `python-cmudict`. This can cause issues if `nltk` is not installed or the `cmudict` data is not downloaded.fixEnsure `nltk` is installed (`pip install nltk`) and download the 'cmudict' corpus if you encounter errors with `syllable_count` for English text: `import nltk; nltk.download('cmudict')`. affects: 0.7.5 - 0.7.11
gotchaThe `1.0.0-alpha` pre-releases introduce a completely new object-oriented API (e.g., `from textstat import Text`). This API is not compatible with the stable 0.7.x series, which uses direct functional imports (e.g., `from textstat import flesch_reading_ease`). Using the alpha API with a stable installation will result in `ImportError` or `AttributeError`.fixAlways refer to the documentation for your installed version. For stable 0.7.x, use direct function calls. If you intend to use the new object-oriented API, install the specific alpha release (e.g., `pip install textstat==1.0.0a1`).
affects: 0.7.x (stable) vs 1.0.0-alpha.x (pre-release)
gotchaAs of version 0.7.13, the `text_standard` function's grade levels are clamped to sensible bounds. This might result in different (potentially less extreme) grade level outputs compared to earlier versions that did not have this clamping.fixBe aware of the clamping behavior when comparing results with older versions. The change aims to provide more realistic grade level assessments.
affects: >=0.7.13
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'textstat'
The 'textstat' library has not been installed in the current Python environment.
TypeError: expected string or bytes-like object
A textstat function received an input argument that was not a string or bytes-like object.
fixEnsure the input argument to any textstat function is a string containing the text to be analyzed.
NameError: name 'flesch_reading_ease' is not defined
A textstat function was called without being imported or without being qualified with the 'textstat' module name.
fixEither call the function as `textstat.flesch_reading_ease()` after `import textstat`, or import the specific function using `from textstat import flesch_reading_ease`.
ModuleNotFoundError: No module named 'textstat.textstat'
The textstat library functions are directly available from the top-level 'textstat' module, not from a nested 'textstat' submodule.
fixImport functions directly from 'textstat', for example, `from textstat import flesch_reading_ease` or `import textstat`.
Upgrade
Version history
0.7.13latest on PyPI · released Feb 18, 2026
Audit
Dependencies
nltkoptionalRequired for 'en_US' syllable counting, specifically the 'cmudict' corpus.