presidio-analyzer 2.2.362


pip install presidio-analyzer

  Latest version

Released: Mar 15, 2026

Project Links

Meta
Author: Presidio
Requires Python: >=3.10,<3.14

Classifiers

License
  • OSI Approved :: MIT License

Operating System
  • OS Independent

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

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

2.2.362 Mar 15, 2026
2.2.361 Feb 12, 2026
2.2.360 Sep 09, 2025
2.2.359 Jul 13, 2025
2.2.358 Mar 18, 2025
2.2.357 Jan 13, 2025
2.2.356 Dec 15, 2024
2.2.355 Jul 22, 2024
2.2.354 Mar 29, 2024
2.2.353 Feb 12, 2024
2.2.352 Jan 22, 2024
2.2.351 Nov 08, 2023
2.2.350 Nov 02, 2023
2.2.35 Oct 31, 2023
2.2.34 Oct 30, 2023
2.2.33 Jun 04, 2023
2.2.32 Jan 31, 2023
2.2.31 Dec 14, 2022
2.2.30 Oct 25, 2022
2.2.29 Jul 12, 2022
2.2.28 May 08, 2022
2.2.27 Mar 09, 2022
2.2.26 Feb 24, 2022
2.2.25 Feb 22, 2022
2.2.24 Jan 26, 2022
2.2.23 Nov 16, 2021
2.2.22 Oct 03, 2021
2.2.21 Jun 14, 2021
2.2.4 Nov 02, 2023
2.2.2 Jun 09, 2021
2.2.1 May 10, 2021
2.2.0 Apr 12, 2021
2.1.0 Mar 25, 2021
2.0.3 Mar 25, 2021
2.0.2 Mar 25, 2021
2.0.1 Mar 04, 2021
2.0.0 Mar 01, 2021
2.0.0rc1 Mar 01, 2021
1.11.0 Feb 11, 2021
1.10.0 Feb 08, 2021
1.9.0 Feb 07, 2021
0.95 Feb 25, 2021
0.3.10649rc0 Feb 09, 2021
0.3.10541.dev0 Feb 05, 2021
0.3.9684.dev0 Oct 26, 2020
0.3.9671rc0 Sep 30, 2020
0.3.9547rc0 Aug 10, 2020
0.3.9545rc0 Aug 09, 2020
0.3.9542rc0 Aug 06, 2020
0.3.9540rc0 Aug 05, 2020
0.3.9537.dev0 Aug 04, 2020
0.3.9535rc0 Aug 01, 2020
0.3.9528rc0 Jul 28, 2020
0.3.9525.dev0 Jul 27, 2020
0.3.9491.dev0 Jul 09, 2020
0.3.9488rc0 Jul 07, 2020
0.3.9352rc0 Jun 22, 2020
0.3.9237rc0 Jun 07, 2020
0.3.9231.dev0 Jun 05, 2020
0.3.8917rc0 May 26, 2020
0.3.8780.dev0 May 06, 2020
0.3.8779.dev0 May 06, 2020
0.3.8778.dev0 May 06, 2020
0.3.8774rc0 May 06, 2020
0.3.8768rc0 May 04, 2020
0.3.8767.dev0 May 04, 2020
0.3.8763rc0 May 03, 2020
0.3.8758.dev0 May 02, 2020
0.3.8754rc0 Apr 30, 2020
0.3.8750rc0 Apr 30, 2020
0.3.8743rc0 Apr 30, 2020
0.3.8740.dev0 Apr 30, 2020
0.3.8705.dev0 Apr 22, 2020
0.3.8697.dev0 Apr 22, 2020
0.3.8689rc0 Apr 21, 2020
0.3.8666rc0 Apr 20, 2020
0.3.8636.dev0 Apr 13, 2020
0.3.8635.dev0 Apr 13, 2020
0.3.8628rc0 Apr 12, 2020
0.3.8622rc0 Apr 10, 2020
0.3.8619rc0 Apr 10, 2020
0.3.8614rc0 Apr 09, 2020
0.3.8602rc0 Apr 06, 2020
0.3.8600rc0 Apr 05, 2020
0.3.8575rc0 Mar 30, 2020
0.3.8573.dev0 Mar 30, 2020
0.3.8571.dev0 Mar 30, 2020
0.3.8513rc0 Mar 24, 2020
0.3.8493.dev0 Mar 23, 2020
0.3.8468.dev0 Mar 22, 2020
0.3.8467.dev0 Mar 22, 2020
0.3.8463.dev0 Mar 22, 2020
0.3.8450.dev0 Mar 22, 2020
0.3.8443rc0 Mar 22, 2020
0.3.8441rc0 Mar 22, 2020
0.3.8405rc0 Mar 16, 2020
0.3.8400.dev0 Mar 15, 2020
0.3.8396.dev0 Mar 15, 2020
0.3.8395.dev0 Mar 15, 2020
0.3.8359rc0 Mar 12, 2020
0.3.8326rc0 Mar 12, 2020
0.3.8307rc0 Mar 11, 2020
0.3.8303.dev0 Mar 11, 2020
0.3.8293.dev0 Mar 11, 2020
0.3.8278.dev0 Mar 10, 2020
0.3.8273.dev0 Mar 10, 2020

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
phonenumbers (<10.0.0,>=8.12)
pydantic (<3.0.0,>=2.0.0)
pyyaml
regex
spacy (!=3.7.0,>=3.4.4)
tldextract