Registry / ai-ml / stanza

stanza

JSON →
library1.14.0pypypi✓ verified 27d ago

Stanza, by the Stanford NLP Group, is a Python NLP library supporting over 70 human languages. It offers a fully neural pipeline for various text analysis tasks, including tokenization, multi-word token expansion, lemmatization, part-of-speech and morphological feature tagging, dependency parsing, and named entity recognition. Stanza also provides a stable Python interface to the Java Stanford CoreNLP Toolkit. Actively maintained, it receives regular updates, with the current version being 1.11.1.

pip install stanza
INSTALL
IMPORT
SIG · STANZA
S
stanza
ai-mlpythonv1.14.0
Install
69.8s avg
Import
8195ms
Disk
2182MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.3 · 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
glibc
py 3.10
✓ —
✓ 79.5s
py 3.11
✓ —
✓ 74.8s
py 3.12
✓ —
✓ 63.8s
py 3.13
✓ —
✓ 61.2s
py 3.9
✓ —
✕ timeout
2182MB installed
● package 2182MB
Code
Verified usage

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

stanza
✓ import stanza

This quickstart downloads the default English language model, initializes a Stanza pipeline, processes a sample text, and then prints out token-level annotations (UPOS, lemma, dependency relation) and named entities.

import stanza # Download an English model (only needs to be run once) # Stanza will auto-download if models are not found, but explicit download is good practice. stanza.download('en') # Initialize the English neural pipeline nlp = stanza.Pipeline('en') # Process some text text = "Barack Obama was born in Hawaii. He was the 44th President of the United States." doc = nlp(text) # Access annotations print(f"Processing: '{text}'") for i, sent in enumerate(doc.sentences): print(f"\nSentence {i+1}:") for word in sent.words: print(f" {word.text}\tUPOS: {word.upos}\tLemma: {word.lemma}\tDepRel: {word.deprel}\tHead: {doc.sentences[0].words[word.head-1].text if word.head > 0 else 'ROOT'}") print("\nNamed Entities:") for ent in doc.entities: print(f" {ent.text}\tType: {ent.type}")
stanza --version
Debug
Known issues
breakingAs of v1.11.1, Stanza's default model download location has changed from `~/stanza_resources` to system-specific cache directories via `platformdirs`. This may affect users who relied on the old default path or custom scripts expecting models in `~/stanza_resources`.
fix
Update your code to check the new default location (e.g., `platformdirs.user_cache_dir('stanza')`) or explicitly specify the model directory using the `dir` parameter in `stanza.download()` and `stanza.Pipeline()`, or by setting the `STANZA_RESOURCES_DIR` environment variable.
affects: >=1.11.1
gotchaStanza's neural models require PyTorch. Users often encounter `ERROR: Could not find a version that satisfies the requirement torch` during `pip install stanza` if PyTorch is not pre-installed or if there are compatibility issues. Installing PyTorch separately first, especially via a system package manager (e.g., `conda install pytorch ...`), is frequently recommended for a smoother installation.
fix
Ensure PyTorch is installed and compatible with your system and Python version *before* installing Stanza. Refer to the official PyTorch installation instructions for your environment.
affects: All versions
gotchaProcessing individual documents or sentences one by one in a loop can be significantly slower than processing them in batches. Stanza is optimized for batch processing.
fix
Collect multiple texts into a list and pass the list to the `nlp()` pipeline for annotation to improve performance.
affects: All versions
deprecatedPrior to version 1.0.0, the library was named `stanfordnlp`. If you are looking for very old documentation or examples, you might encounter references to this legacy package name.
fix
For new projects, always use `stanza`. If working with legacy code, be aware that `pip install stanfordnlp` would be required for older versions.
affects: <1.0.0
gotchaStanza has a strict Python version requirement of >=3.9. Using older Python versions can lead to various runtime errors, including `OSError: [Errno 22] Invalid argument` during model loading on macOS with Python <=3.7.1.
fix
Ensure your Python environment is running version 3.9 or newer. Upgrade Python if necessary.
affects: All versions (if Python < 3.9)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'stanza'
The 'stanza' library has not been installed in the current Python environment.
fix
pip install stanza
stanza.pipeline.core.StanzaFileNotFoundError: Cannot find model for lang=en
The necessary language models for the specified language (e.g., 'en') have not been downloaded or cannot be found by Stanza.
fix
stanza.download('en')
ValueError: Invalid argument to Stanza. The 'processors' parameter has unexpected value
The 'processors' argument in `stanza.Pipeline` was provided with an invalid or unrecognized processor name.
fix
Ensure processor names are valid, choosing from options like 'tokenize', 'mwt', 'pos', 'lemma', 'depparse', 'ner', 'sentiment', etc.
AttributeError: 'Word' object has no attribute 'lemma'
The requested attribute (e.g., 'lemma') does not exist on the `Word` object because the corresponding processor (e.g., 'lemmatize') was not included in the `stanza.Pipeline` initialization.
fix
Add the necessary processor to the `processors` list when creating the `stanza.Pipeline`, for example: `stanza.Pipeline(processors='tokenize,pos,lemma')`.
RuntimeError: CoreNLP server is not running at http://127.0.0.1:9000
Stanza is configured to connect to a Stanford CoreNLP server, but the server is either not running or is inaccessible at the specified host and port.
fix
Start the Stanford CoreNLP server in a separate process, or ensure the `host` and `port` parameters in `stanza.Pipeline` match the server's address and port.
Upgrade
Version history
1.14.0latest on PyPI · released Jul 15, 2026
Audit
Dependencies
pytorchrequiredRequired for Stanza's neural network models; often recommended to install separately before Stanza to avoid dependency conflicts or build issues.
transformersoptionalOptional for advanced features like improved accuracy with fine-tuned transformer models, enabled via 'pip install stanza[transformers]'.
peftoptionalOptional, integrated for smaller models and used with transformers, enabled via 'pip install stanza[transformers]'.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources