Registry / auth-security / presidio-analyzer

presidio-analyzer

JSON →
library2.2.364pypypi✓ verified 26d ago

Presidio Analyzer is a Python library and service for detecting Personally Identifiable Information (PII) entities in text. It leverages a combination of predefined recognizers, regular expressions, and Named Entity Recognition (NER) models to identify sensitive data. The library is actively maintained, with a current version of 2.2.362, and releases frequently to add new features, fix bugs, and improve detection capabilities.

pip install presidio-analyzer
INSTALL
IMPORT
SIG · PRESIDIO-ANALYZER
P
presidio-analyzer
auth-securitypythonv2.2.364
Install
17.8s avg
Import
5014ms
Disk
370MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.2.364 · 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
✓ —
✓ 19.4s
py 3.11
✓ —
✓ 18.5s
py 3.12
✓ —
✓ 16.9s
py 3.13
✓ —
✓ 16.5s
py 3.9
✕ build_error
✕ build_error
370MB installed
● package 370MB
Code
Verified usage

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

AnalyzerEngine
from presidio_analyzer import AnalyzerEngine
from presidio_analyzer import AnalyzerEngine
PatternRecognizer
from presidio_analyzer import PatternRecognizer
RecognizerRegistry
from presidio_analyzer import RecognizerRegistry

This quickstart demonstrates how to initialize the AnalyzerEngine and detect PII entities in a given text. Ensure you have downloaded the `en_core_web_lg` spaCy model as instructed in the installation steps, as it's used by default for NLP capabilities. The output will show detected entities, their location, and a confidence score.

from presidio_analyzer import AnalyzerEngine # Initialize the AnalyzerEngine # This will load the default spaCy NLP model (en_core_web_lg if downloaded) analyzer = AnalyzerEngine() text = "My name is John Doe and my phone number is (123) 456-7890." # Analyze the text for PII entities # Specify entities to look for, or leave empty for all supported entities results = analyzer.analyze(text=text, entities=["PERSON", "PHONE_NUMBER"], language='en') for result in results: print(f"Entity: {result.entity_type}, Text: {text[result.start:result.end]}, Score: {result.score:.2f}")
presidio-analyzer --version
Debug
Known issues
breakingPresidio underwent a significant revamp from V1 to V2 (starting around 2.0.0). This involved a migration from gRPC to HTTP-based APIs, changes in JSON payload formats (structured objects to flattened JSON, camelCase to snake_case), and deprecation of some services. Code written for V1 is not compatible with V2 APIs.
fix
Refer to the 'Changes from V1 to V2' documentation on the Presidio website. Rewrite API calls and update data structures to conform to the new HTTP/JSON format.
affects: All versions >= 2.0.0 (breaking from V1)
gotchaMany country-specific PII recognizers (e.g., for Singapore, Australia, Germany, Sweden) are disabled by default to prevent false positives when they are not explicitly needed. If you require detection for specific regional PII, you must explicitly enable these recognizers either via a YAML configuration file or programmatically by adding them to the RecognizerRegistry.
fix
Review the documentation for 'Recognizer registry from file' or programmatic `RecognizerRegistry` customization to enable specific country-specific recognizers.
affects: 2.2.359 and later
gotchaThe AnalyzerEngine relies on NLP models (like spaCy) for many detections. While `spacy` itself is a dependency, the language models (e.g., `en_core_web_lg`) must be downloaded separately using `python -m spacy download <model_name>`. Failure to do so will result in errors or limited detection capabilities.
fix
Always run `python -m spacy download <model_name>` for the languages you intend to analyze, as part of your environment setup.
affects: All versions
gotchaSpecific versions of underlying NLP libraries, particularly spaCy, might be explicitly restricted in certain `presidio-analyzer` releases. For example, `spacy.cli` was restricted for version 3.7.0 in release 2.2.356. Using an incompatible spaCy version can lead to unexpected behavior or errors.
fix
Always check the `presidio-analyzer` release notes and `pyproject.toml` for explicit dependency version constraints and ensure your environment adheres to them.
affects: Specific patch versions (e.g., 2.2.356 for spaCy 3.7.0)
gotchaUsers employing static type checking (e.g., mypy) may encounter type errors in versions after 2.2.33, specifically related to the initialization of `AnonymizerEngine` and type mismatches for `RecognizerResult` between `presidio-analyzer` and `presidio-anonymizer` due to separate class definitions.
fix
Monitor GitHub issues for type-related fixes. Depending on the error, temporary workarounds might include `type: ignore` comments or casting until official fixes are released.
affects: 2.2.354 and later (potentially from 2.2.33)
Upgrade
Version history
2.2.364latest on PyPI · released Jul 22, 2026
Audit
Dependencies
spacyrequiredRequired for the default NLP engine used by AnalyzerEngine for advanced PII detection.
transformersoptionalOptional extra for using Hugging Face Transformers models as an NLP engine.
stanzaoptionalOptional extra for using Stanza NLP models as an NLP engine.
Agent activity
40 hits · last 30 days
node
38
OpenAI (training)
1
Resources
presidio-analyzer — pip install presidio-analyzer · libregistry