Skip to main content

Presidio analyzer

Description

The Presidio analyzer is a Python based service for detecting PII entities in text.

During analysis, it runs a set of different PII Recognizers, each one in charge of detecting one or more PII entities using different mechanisms.

Presidio analyzer comes with a set of predefined recognizers, but can easily be extended with other types of custom recognizers. Predefined and custom recognizers leverage regex, Named Entity Recognition and other types of logic to detect PII in unstructured text.

Language Model-based PII/PHI Detection

Presidio analyzer supports language model-based PII/PHI detection (LLMs, SLMs) for flexible entity recognition. The current implementation uses LangExtract with support for multiple providers:

  • Ollama - Local model deployment for privacy-sensitive environments
  • Azure OpenAI - Cloud-based deployment with enterprise features
pip install "presidio-analyzer[langextract]"

Quick Usage

Ollama (local models):

from presidio_analyzer.predefined_recognizers import BasicLangExtractRecognizer
recognizer = BasicLangExtractRecognizer()  # Uses default config

Azure OpenAI (cloud models):

from presidio_analyzer.predefined_recognizers import AzureOpenAILangExtractRecognizer

# Simple usage - pass everything as parameters
recognizer = AzureOpenAILangExtractRecognizer(
    model_id="gpt-4",  # Your Azure deployment name
    azure_endpoint="https://your-resource.openai.azure.com/",
    api_key="your-api-key"
)

# Or use environment variables (AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY):
recognizer = AzureOpenAILangExtractRecognizer(
    model_id="gpt-4"  # Your Azure deployment name
)

# Advanced: Customize entities/prompts with config file
recognizer = AzureOpenAILangExtractRecognizer(
    model_id="gpt-4",
    config_path="./custom_config.yaml",  # Optional: for custom entities/prompts
    azure_endpoint="https://your-resource.openai.azure.com/",
    api_key="your-api-key"
)

Note: LangExtract recognizers do not validate connectivity during initialization. Connection errors or missing models will be reported when analyze() is first called.

See the Language Model-based PII/PHI Detection guide for complete setup and usage instructions.

Deploy Presidio analyzer to Azure

Use the following button to deploy presidio analyzer to your Azure subscription.

Deploy to Azure

Simple usage example

from presidio_analyzer import AnalyzerEngine

# Set up the engine, loads the NLP module (spaCy model by default) and other PII recognizers
analyzer = AnalyzerEngine()

# Call analyzer to get results
results = analyzer.analyze(text="My phone number is 212-555-5555",
                           entities=["PHONE_NUMBER"],
                           language='en')
print(results)

GPU Acceleration

For GPU acceleration, install the appropriate dependencies for your hardware:

  • Linux with NVIDIA GPU: cupy-cuda12x (or the version matching your CUDA installation)
  • macOS with Apple Silicon: MPS (Metal Performance Shaders) is currently not supported. The analyzer will use CPU for PyTorch operations.

Documentation

Additional documentation on installation, usage and extending the Analyzer can be found under the Analyzer section of Presidio Documentation

Release files for presidio-analyzer 2.2.364

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for presidio-analyzer 2.2.364
File Size Uploaded
presidio_analyzer-2.2.364.tar.gz 154.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for presidio-analyzer 2.2.364
File Interpreter ABI Platform
presidio_analyzer-2.2.364-py3-none-any.whl Python 3 none any Details

Total release size: 420.4 kB

Release files / presidio_analyzer-2.2.364.tar.gz

Download URL presidio_analyzer-2.2.364.tar.gz
Size 154.1 kB
Tags Source
SHA-256 checksum
How to use checksums
51f27bacf199fb9777ade9552c0f0111e00a1d73cfe2d4797fc05c998de1e0b6
BLAKE2b-256 checksum
How to use checksums
c750408a41cf99d076107d3823d514bb6408e249132418f068673cb807839ce5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / presidio_analyzer-2.2.364-py3-none-any.whl

Download URL presidio_analyzer-2.2.364-py3-none-any.whl
Size 266.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a9eeb60ccc416c505367b4989d056becb84ef082703ee3361c046fb75941739
BLAKE2b-256 checksum
How to use checksums
a61544a64276cd5c45485716314addfb7966c24f61034d8ff8e9a78d13d0afbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.2.364 This release

2 release files

2.2.362

1 release file

2.2.361

1 release file

2.2.359

1 release file

2.2.358

1 release file

2.2.357

1 release file

2.2.356

1 release file

2.2.355

1 release file

2.2.354

1 release file

2.2.353

1 release file

2.2.352

1 release file

2.2.35

1 release file

2.2.34

1 release file

2.2.33

1 release file

2.2.32

1 release file

2.2.31

1 release file

2.2.30

1 release file

2.2.29

1 release file

2.2.28

1 release file

2.2.27

1 release file

2.2.26

1 release file

2.2.25

1 release file

2.2.24

1 release file

2.2.23

1 release file

2.2.22

1 release file

2.2.21

1 release file

2.2.4

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.11.0

1 release file

1.10.0

1 release file

1.9.0

1 release file

0.95

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page