
仮想環境の作成
仮想環境作成
公式サイトによると、対応しているPythonのバージョンは3.10~3.13とのこと。
Anacondaで以下のコマンドで仮想環境を新規作成した。
conda create -n presidio_20260831 python==3.13pip install presidio_analyzer[transformers]
仮想環境をアクティベートして、以下のコマンドでPresidioをpip installする。
pip install "presidio_analyzer[transformers]"↓実行結果
Collecting presidio_analyzer[transformers]
Downloading presidio_analyzer-2.2.364-py3-none-any.whl.metadata (6.7 kB)
Collecting accelerate<2.0.0,>=0.20.0 (from presidio_analyzer[transformers])
Using cached accelerate-1.14.0-py3-none-any.whl.metadata (19 kB)
Collecting click<9.0.0,>=8.1.0 (from presidio_analyzer[transformers])
Downloading click-8.5.0-py3-none-any.whl.metadata (2.6 kB)
Collecting huggingface_hub<2.0.0,>=0.20.0 (from presidio_analyzer[transformers])
Downloading huggingface_hub-1.29.0-py3-none-any.whl.metadata (16 kB)
Collecting numpy<2.5.0,>=1.19.0 (from presidio_analyzer[transformers])
Using cached numpy-2.4.6-cp313-cp313-win_amd64.whl.metadata (6.6 kB)
Collecting phonenumbers<10.0.0,>=9.0.28 (from presidio_analyzer[transformers])
Downloading phonenumbers-9.0.38-py2.py3-none-any.whl.metadata (10 kB)
Collecting pydantic<3.0.0,>=2.12.5 (from presidio_analyzer[transformers])
Downloading pydantic-2.13.5-py3-none-any.whl.metadata (110 kB)
Collecting pyyaml<7.0.0,>=6.0.3 (from presidio_analyzer[transformers])
Using cached pyyaml-6.0.3-cp313-cp313-win_amd64.whl.metadata (2.4 kB)
Collecting regex>=2023.0.0 (from presidio_analyzer[transformers])
Downloading regex-2026.8.31-cp313-cp313-win_amd64.whl.metadata (41 kB)
Collecting spacy!=3.7.0,<4.0.0,>=3.4.4 (from presidio_analyzer[transformers])
Downloading spacy-3.8.16-cp313-cp313-win_amd64.whl.metadata (28 kB)
Collecting spacy_huggingface_pipelines<1.0.0,>=0.0.4 (from presidio_analyzer[transformers])
Downloading spacy_huggingface_pipelines-0.0.4-py2.py3-none-any.whl.metadata (10.0 kB)
Collecting tldextract<6.0.0,>=5.3.1 (from presidio_analyzer[transformers])
Downloading tldextract-5.3.2-py3-none-any.whl.metadata (7.9 kB)
Collecting transformers<6.0.0,>=4.0.0 (from presidio_analyzer[transformers])
Downloading transformers-5.16.1-py3-none-any.whl.metadata (32 kB)
Requirement already satisfied: packaging>=20.0 in C:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages (from accelerate<2.0.0,>=0.20.0->presidio_analyzer[transformers]) (26.3)
Collecting psutil (from accelerate<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached psutil-7.2.2-cp37-abi3-win_amd64.whl.metadata (22 kB)
Collecting torch>=2.0.0 (from accelerate<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Downloading torch-2.13.0-cp313-cp313-win_amd64.whl.metadata (39 kB)
Collecting safetensors>=0.4.3 (from accelerate<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached safetensors-0.8.0-cp310-abi3-win_amd64.whl.metadata (4.2 kB)
Collecting filelock>=3.10.0 (from huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Downloading filelock-3.32.4-py3-none-any.whl.metadata (2.0 kB)
Collecting fsspec>=2023.5.0 (from huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Downloading fsspec-2026.7.0-py3-none-any.whl.metadata (10 kB)
Collecting hf-xet<2.0.0,>=1.5.2 (from huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Downloading hf_xet-1.6.0-cp38-abi3-win_amd64.whl.metadata (4.9 kB)
Collecting httpx<1,>=0.23.0 (from huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)
Collecting tqdm>=4.42.1 (from huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached tqdm-4.70.0-py3-none-any.whl.metadata (57 kB)
Collecting typing-extensions>=4.1.0 (from huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached typing_extensions-4.16.0-py3-none-any.whl.metadata (3.3 kB)
Collecting anyio (from httpx<1,>=0.23.0->huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached anyio-4.14.2-py3-none-any.whl.metadata (4.6 kB)
Collecting certifi (from httpx<1,>=0.23.0->huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached certifi-2026.7.22-py3-none-any.whl.metadata (2.5 kB)
Collecting httpcore==1.* (from httpx<1,>=0.23.0->huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached httpcore-1.0.9-py3-none-any.whl.metadata (21 kB)
Collecting idna (from httpx<1,>=0.23.0->huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Downloading idna-3.19-py3-none-any.whl.metadata (9.2 kB)
Collecting h11>=0.16 (from httpcore==1.*->httpx<1,>=0.23.0->huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached h11-0.16.0-py3-none-any.whl.metadata (8.3 kB)
Collecting annotated-types>=0.6.0 (from pydantic<3.0.0,>=2.12.5->presidio_analyzer[transformers])
Using cached annotated_types-0.8.0-py3-none-any.whl.metadata (15 kB)
Collecting pydantic-core==2.46.5 (from pydantic<3.0.0,>=2.12.5->presidio_analyzer[transformers])
Downloading pydantic_core-2.46.5-cp313-cp313-win_amd64.whl.metadata (6.7 kB)
Collecting typing-inspection>=0.4.2 (from pydantic<3.0.0,>=2.12.5->presidio_analyzer[transformers])
Downloading typing_inspection-0.4.4-py3-none-any.whl.metadata (2.6 kB)
Collecting spacy-legacy<3.1.0,>=3.0.11 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading spacy_legacy-3.0.12-py2.py3-none-any.whl.metadata (2.8 kB)
Collecting spacy-loggers<2.0.0,>=1.0.0 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading spacy_loggers-1.0.5-py3-none-any.whl.metadata (23 kB)
Collecting murmurhash<1.1.0,>=0.28.0 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading murmurhash-1.0.15-cp313-cp313-win_amd64.whl.metadata (2.3 kB)
Collecting cymem<2.1.0,>=2.0.2 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading cymem-2.0.13-cp313-cp313-win_amd64.whl.metadata (9.9 kB)
Collecting preshed<3.1.0,>=3.0.2 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading preshed-3.0.13-cp313-cp313-win_amd64.whl.metadata (5.4 kB)
Collecting thinc<8.4.0,>=8.3.12 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading thinc-8.3.13-cp313-cp313-win_amd64.whl.metadata (15 kB)
Collecting wasabi<1.2.0,>=0.9.1 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading wasabi-1.1.3-py3-none-any.whl.metadata (28 kB)
Collecting srsly<3.0.0,>=2.5.3 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading srsly-2.5.3-cp313-cp313-win_amd64.whl.metadata (20 kB)
Collecting catalogue<2.1.0,>=2.0.6 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading catalogue-2.0.10-py3-none-any.whl.metadata (14 kB)
Collecting weasel<2.0.0,>=1.0.0 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading weasel-1.0.0-py3-none-any.whl.metadata (4.6 kB)
Collecting confection<2.0.0,>=1.3.2 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading confection-1.3.3-py3-none-any.whl.metadata (19 kB)
Collecting typer<1.0.0,>=0.3.0 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading typer-0.27.2-py3-none-any.whl.metadata (16 kB)
Collecting requests<3.0.0,>=2.13.0 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached requests-2.34.2-py3-none-any.whl.metadata (4.8 kB)
Collecting jinja2 (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached jinja2-3.1.6-py3-none-any.whl.metadata (2.9 kB)
Requirement already satisfied: setuptools in C:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages (from spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers]) (83.0.0)
Collecting charset_normalizer<4,>=2 (from requests<3.0.0,>=2.13.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading charset_normalizer-3.5.1-cp313-cp313-win_amd64.whl.metadata (46 kB)
Collecting urllib3<3,>=1.26 (from requests<3.0.0,>=2.13.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached urllib3-2.7.0-py3-none-any.whl.metadata (6.9 kB)
Collecting transformers<6.0.0,>=4.0.0 (from presidio_analyzer[transformers])
Using cached transformers-4.57.6-py3-none-any.whl.metadata (43 kB)
Collecting blis<1.4.0,>=1.3.0 (from thinc<8.4.0,>=8.3.12->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading blis-1.3.3-cp313-cp313-win_amd64.whl.metadata (7.7 kB)
Collecting requests-file>=1.4 (from tldextract<6.0.0,>=5.3.1->presidio_analyzer[transformers])
Downloading requests_file-3.0.1-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting colorama (from tqdm>=4.42.1->huggingface_hub<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting huggingface_hub<2.0.0,>=0.20.0 (from presidio_analyzer[transformers])
Using cached huggingface_hub-0.36.2-py3-none-any.whl.metadata (15 kB)
Collecting tokenizers<=0.23.0,>=0.22.0 (from transformers<6.0.0,>=4.0.0->presidio_analyzer[transformers])
Using cached tokenizers-0.22.2-cp39-abi3-win_amd64.whl.metadata (7.4 kB)
Collecting shellingham>=1.3.0 (from typer<1.0.0,>=0.3.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting rich>=13.8.0 (from typer<1.0.0,>=0.3.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached rich-15.0.0-py3-none-any.whl.metadata (18 kB)
Collecting annotated-doc>=0.0.2 (from typer<1.0.0,>=0.3.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading annotated_doc-0.0.5-py3-none-any.whl.metadata (6.5 kB)
Collecting cloudpathlib>=0.7.0 (from weasel<2.0.0,>=1.0.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading cloudpathlib-0.25.0-py3-none-any.whl.metadata (16 kB)
Collecting smart-open>=5.2.1 (from weasel<2.0.0,>=1.0.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading smart_open-8.0.1-py3-none-any.whl.metadata (24 kB)
Collecting markdown-it-py>=2.2.0 (from rich>=13.8.0->typer<1.0.0,>=0.3.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached markdown_it_py-4.2.0-py3-none-any.whl.metadata (7.4 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich>=13.8.0->typer<1.0.0,>=0.3.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading pygments-2.21.0-py3-none-any.whl.metadata (2.5 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=13.8.0->typer<1.0.0,>=0.3.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
Collecting wrapt (from smart-open>=5.2.1->weasel<2.0.0,>=1.0.0->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Downloading wrapt-2.4.0-cp313-cp313-win_amd64.whl.metadata (7.6 kB)
Collecting sympy>=1.13.3 (from torch>=2.0.0->accelerate<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached sympy-1.14.0-py3-none-any.whl.metadata (12 kB)
Collecting networkx>=2.5.1 (from torch>=2.0.0->accelerate<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached networkx-3.6.1-py3-none-any.whl.metadata (6.8 kB)
Collecting mpmath<1.4,>=1.1.0 (from sympy>=1.13.3->torch>=2.0.0->accelerate<2.0.0,>=0.20.0->presidio_analyzer[transformers])
Using cached mpmath-1.3.0-py3-none-any.whl.metadata (8.6 kB)
Collecting MarkupSafe>=2.0 (from jinja2->spacy!=3.7.0,<4.0.0,>=3.4.4->presidio_analyzer[transformers])
Using cached markupsafe-3.0.3-cp313-cp313-win_amd64.whl.metadata (2.8 kB)
Downloading presidio_analyzer-2.2.364-py3-none-any.whl (266 kB)
Using cached accelerate-1.14.0-py3-none-any.whl (389 kB)
Downloading click-8.5.0-py3-none-any.whl (125 kB)
Using cached httpx-0.28.1-py3-none-any.whl (73 kB)
Using cached httpcore-1.0.9-py3-none-any.whl (78 kB)
Using cached numpy-2.4.6-cp313-cp313-win_amd64.whl (12.3 MB)
Downloading phonenumbers-9.0.38-py2.py3-none-any.whl (2.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 9.4 MB/s 0:00:00
Downloading pydantic-2.13.5-py3-none-any.whl (472 kB)
Downloading pydantic_core-2.46.5-cp313-cp313-win_amd64.whl (2.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 9.9 MB/s 0:00:00
Using cached pyyaml-6.0.3-cp313-cp313-win_amd64.whl (154 kB)
Downloading spacy-3.8.16-cp313-cp313-win_amd64.whl (15.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.2/15.2 MB 10.2 MB/s 0:00:01
Downloading catalogue-2.0.10-py3-none-any.whl (17 kB)
Downloading confection-1.3.3-py3-none-any.whl (35 kB)
Downloading cymem-2.0.13-cp313-cp313-win_amd64.whl (40 kB)
Downloading murmurhash-1.0.15-cp313-cp313-win_amd64.whl (25 kB)
Downloading preshed-3.0.13-cp313-cp313-win_amd64.whl (122 kB)
Using cached requests-2.34.2-py3-none-any.whl (73 kB)
Downloading charset_normalizer-3.5.1-cp313-cp313-win_amd64.whl (199 kB)
Downloading idna-3.19-py3-none-any.whl (68 kB)
Downloading spacy_huggingface_pipelines-0.0.4-py2.py3-none-any.whl (11 kB)
Downloading spacy_legacy-3.0.12-py2.py3-none-any.whl (29 kB)
Downloading spacy_loggers-1.0.5-py3-none-any.whl (22 kB)
Downloading srsly-2.5.3-cp313-cp313-win_amd64.whl (650 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 650.8/650.8 kB 8.0 MB/s 0:00:00
Downloading thinc-8.3.13-cp313-cp313-win_amd64.whl (1.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 9.7 MB/s 0:00:00
Downloading blis-1.3.3-cp313-cp313-win_amd64.whl (6.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.2/6.2 MB 10.0 MB/s 0:00:00
Downloading tldextract-5.3.2-py3-none-any.whl (106 kB)
Using cached tqdm-4.70.0-py3-none-any.whl (80 kB)
Using cached transformers-4.57.6-py3-none-any.whl (12.0 MB)
Using cached huggingface_hub-0.36.2-py3-none-any.whl (566 kB)
Using cached tokenizers-0.22.2-cp39-abi3-win_amd64.whl (2.7 MB)
Downloading typer-0.27.2-py3-none-any.whl (123 kB)
Using cached urllib3-2.7.0-py3-none-any.whl (131 kB)
Downloading wasabi-1.1.3-py3-none-any.whl (27 kB)
Downloading weasel-1.0.0-py3-none-any.whl (50 kB)
Downloading annotated_doc-0.0.5-py3-none-any.whl (5.3 kB)
Using cached annotated_types-0.8.0-py3-none-any.whl (13 kB)
Using cached certifi-2026.7.22-py3-none-any.whl (136 kB)
Downloading cloudpathlib-0.25.0-py3-none-any.whl (66 kB)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Downloading filelock-3.32.4-py3-none-any.whl (99 kB)
Downloading fsspec-2026.7.0-py3-none-any.whl (206 kB)
Using cached h11-0.16.0-py3-none-any.whl (37 kB)
Downloading regex-2026.8.31-cp313-cp313-win_amd64.whl (277 kB)
Downloading requests_file-3.0.1-py2.py3-none-any.whl (4.5 kB)
Using cached rich-15.0.0-py3-none-any.whl (310 kB)
Downloading pygments-2.21.0-py3-none-any.whl (1.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 9.7 MB/s 0:00:00
Using cached markdown_it_py-4.2.0-py3-none-any.whl (91 kB)
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Using cached safetensors-0.8.0-cp310-abi3-win_amd64.whl (355 kB)
Using cached shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Downloading smart_open-8.0.1-py3-none-any.whl (73 kB)
Downloading torch-2.13.0-cp313-cp313-win_amd64.whl (122.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 122.1/122.1 MB 10.2 MB/s 0:00:12
Using cached networkx-3.6.1-py3-none-any.whl (2.1 MB)
Using cached sympy-1.14.0-py3-none-any.whl (6.3 MB)
Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Using cached typing_extensions-4.16.0-py3-none-any.whl (45 kB)
Downloading typing_inspection-0.4.4-py3-none-any.whl (14 kB)
Using cached anyio-4.14.2-py3-none-any.whl (125 kB)
Using cached jinja2-3.1.6-py3-none-any.whl (134 kB)
Using cached markupsafe-3.0.3-cp313-cp313-win_amd64.whl (15 kB)
Using cached psutil-7.2.2-cp37-abi3-win_amd64.whl (137 kB)
Downloading wrapt-2.4.0-cp313-cp313-win_amd64.whl (96 kB)
Installing collected packages: mpmath, wrapt, urllib3, typing-extensions, sympy, spacy-loggers, spacy-legacy, shellingham, safetensors, regex, pyyaml, pygments, psutil, phonenumbers, numpy, networkx, murmurhash, mdurl, MarkupSafe, idna, h11, fsspec, filelock, cymem, confection, colorama, cloudpathlib, click, charset_normalizer, certifi, catalogue, annotated-types, annotated-doc, wasabi, typing-inspection, tqdm, srsly, smart-open, requests, pydantic-core, preshed, markdown-it-py, jinja2, httpcore, blis, anyio, torch, rich, requests-file, pydantic, huggingface_hub, httpx, typer, tokenizers, tldextract, thinc, accelerate, weasel, transformers, spacy, spacy_huggingface_pipelines, presidio_analyzer
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
cyclopts 4.16.1 requires attrs>=23.1.0, which is not installed.
jsonschema-path 0.5.0 requires attrs>=22.2.0, which is not installed.
jsonschema-path 0.5.0 requires referencing<0.38.0, which is not installed.
langchain-core 1.6.1 requires jsonpatch<2.0.0,>=1.33.0, which is not installed.
langchain-core 1.6.1 requires tenacity!=8.4.0,<10.0.0,>=8.1.0, which is not installed.
langsmith 0.11.2 requires distro>=1.7.0, which is not installed.
langsmith 0.11.2 requires requests-toolbelt>=1.0.0, which is not installed.
langsmith 0.11.2 requires sniffio>=1.1, which is not installed.
langsmith 0.11.2 requires zstandard>=0.23.0, which is not installed.
typing-inspect 0.9.0 requires mypy-extensions>=0.3.0, which is not installed.
Successfully installed MarkupSafe-3.0.3 accelerate-1.14.0 annotated-doc-0.0.5 annotated-types-0.8.0 anyio-4.14.2 blis-1.3.3 catalogue-2.0.10 certifi-2026.7.22 charset_normalizer-3.5.1 click-8.5.0 cloudpathlib-0.25.0 colorama-0.4.6 confection-1.3.3 cymem-2.0.13 filelock-3.32.4 fsspec-2026.7.0 h11-0.16.0 httpcore-1.0.9 httpx-0.28.1 huggingface_hub-0.36.2 idna-3.19 jinja2-3.1.6 markdown-it-py-4.2.0 mdurl-0.1.2 mpmath-1.3.0 murmurhash-1.0.15 networkx-3.6.1 numpy-2.4.6 phonenumbers-9.0.38 preshed-3.0.13 presidio_analyzer-2.2.364 psutil-7.2.2 pydantic-2.13.5 pydantic-core-2.46.5 pygments-2.21.0 pyyaml-6.0.3 regex-2026.8.31 requests-2.34.2 requests-file-3.0.1 rich-15.0.0 safetensors-0.8.0 shellingham-1.5.4 smart-open-8.0.1 spacy-3.8.16 spacy-legacy-3.0.12 spacy-loggers-1.0.5 spacy_huggingface_pipelines-0.0.4 srsly-2.5.3 sympy-1.14.0 thinc-8.3.13 tldextract-5.3.2 tokenizers-0.22.2 torch-2.13.0 tqdm-4.70.0 transformers-4.57.6 typer-0.27.2 typing-extensions-4.16.0 typing-inspection-0.4.4 urllib3-2.7.0 wasabi-1.1.3 weasel-1.0.0 wrapt-2.4.0 エラーを見ると、パッケージ(cyclopts、jsonschema-path、langchain-core、langsmith、typing-inspect)が、それぞれ必要とする依存パッケージ(attrs、tenacity、sniffioなど)を持っていないというエラーなので、追加でpip install。
pip install attrs tenacity sniffio requests-toolbelt distro zstandard jsonpatch mypy-extensions --upgrade↓実行結果
Collecting attrs
Using cached attrs-26.1.0-py3-none-any.whl.metadata (8.8 kB)
Collecting tenacity
Using cached tenacity-9.1.4-py3-none-any.whl.metadata (1.2 kB)
Collecting sniffio
Using cached sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting requests-toolbelt
Using cached requests_toolbelt-1.0.0-py2.py3-none-any.whl.metadata (14 kB)
Collecting distro
Using cached distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)
Collecting zstandard
Using cached zstandard-0.25.0-cp313-cp313-win_amd64.whl.metadata (3.3 kB)
Collecting jsonpatch
Using cached jsonpatch-1.33-py2.py3-none-any.whl.metadata (3.0 kB)
Collecting mypy-extensions
Using cached mypy_extensions-1.1.0-py3-none-any.whl.metadata (1.1 kB)
Requirement already satisfied: requests<3.0.0,>=2.0.1 in C:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages (from requests-toolbelt) (2.34.2)
Requirement already satisfied: charset_normalizer<4,>=2 in C:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages (from requests<3.0.0,>=2.0.1->requests-toolbelt) (3.5.1)
Requirement already satisfied: idna<4,>=2.5 in C:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages (from requests<3.0.0,>=2.0.1->requests-toolbelt) (3.19)
Requirement already satisfied: urllib3<3,>=1.26 in C:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages (from requests<3.0.0,>=2.0.1->requests-toolbelt) (2.7.0)
Requirement already satisfied: certifi>=2023.5.7 in C:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages (from requests<3.0.0,>=2.0.1->requests-toolbelt) (2026.7.22)
Collecting jsonpointer>=1.9 (from jsonpatch)
Using cached jsonpointer-3.1.1-py3-none-any.whl.metadata (2.4 kB)
Using cached attrs-26.1.0-py3-none-any.whl (67 kB)
Using cached tenacity-9.1.4-py3-none-any.whl (28 kB)
Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Using cached requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)
Using cached distro-1.9.0-py3-none-any.whl (20 kB)
Using cached zstandard-0.25.0-cp313-cp313-win_amd64.whl (506 kB)
Using cached jsonpatch-1.33-py2.py3-none-any.whl (12 kB)
Using cached mypy_extensions-1.1.0-py3-none-any.whl (5.0 kB)
Using cached jsonpointer-3.1.1-py3-none-any.whl (7.7 kB)
Installing collected packages: zstandard, tenacity, sniffio, mypy-extensions, jsonpointer, distro, attrs, requests-toolbelt, jsonpatch
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
jsonschema-path 0.5.0 requires referencing<0.38.0, which is not installed.
Successfully installed attrs-26.1.0 distro-1.9.0 jsonpatch-1.33 jsonpointer-3.1.1 mypy-extensions-1.1.0 requests-toolbelt-1.0.0 sniffio-1.3.1 tenacity-9.1.4 zstandard-0.25.0まだエラーが出たので、更にpip install。
pip install cryptography marshmallow==3.26.2 referencingこれで、pip checkが通った。
pip install presidio_anonymizer
次に、公式サイトの案内どおりにpresidio_anonymizerを入れる。
pip install presidio_anonymizerこれはそのままpip checkが通った。
python -m spacy download en_core_web_sm
spaCyの言語モデルをダウンロードする。
python -m spacy download en_core_web_sm言語モデルは仮想環境のsite-packages内に配置される。
(任意)pip install presidio_image_redactor
画像から個人情報を削除する場合に必要となるパッケージをインストールする。
pip install presidio_image_redactortesseract OCRもインストールしておく。これがないと動かん。

↓インストーラーはここ

インストール途中に追加スクリプトを選べる。日本語を追加しておくと吉。
インストールされたフォルダ(デフォはC:\Program Files\Tesseract-OCR)をPATHを通しておくといい。
ただし、下のほうの実行コードのようにインストールパスを指定してあげれば、PATHを通さなくても問題なく動く。
(任意)JupterLabなどのインストール
pip install jupyterlab ipywidgetsrequirements.txt
仮想環境のrequirements.txt
使ってみる
テキスト
実行方法はspaCyモデルを使う方法と、Transformersを使う方法がある。前者だと、ユーザーフォルダ\.cache\huggingface\hub\models–dslim–bert-base-NERにモデルをダウンロードされる。

cacheフォルダにダウンロードされるとCドライブを圧迫されるので、今回は別ドライブに事前にダウンロードしたモデルをTransformersで動かす方法を使う。
テスト用の文章として、では夢の国在住の田中君を使う。
text = "私は田中太郎。住所は279-0031 千葉県浦安市舞浜1−1。電話番号は03-999-9999。マイナンバーは123456789012。"公式ドキュメントどおりに動かす
必要に応じて、以下のモデルを任意の場所にダウンロードしておく。

from presidio_analyzer import AnalyzerEngine
from presidio_analyzer.nlp_engine import TransformersNlpEngine
from presidio_anonymizer import AnonymizerEngine
model_config = [{"lang_code": "en", "model_name": {
"spacy": "en_core_web_sm", # use a small spaCy model for lemmas, tokens etc.
"transformers": r"H:\BERT_Models\dslim\bert-base-NER"
}
}]
nlp_engine = TransformersNlpEngine(models=model_config)
analyzer = AnalyzerEngine(nlp_engine=nlp_engine)
results = analyzer.analyze(text=text, language='en')
print(results)
anonymizer = AnonymizerEngine()
anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results)
print(anonymized_text)↓実行結果
Some weights of the model checkpoint at H:\BERT_Models\dslim\bert-base-NER were not used when initializing BertForTokenClassification: ['bert.pooler.dense.bias', 'bert.pooler.dense.weight']
- This IS expected if you are initializing BertForTokenClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing BertForTokenClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Device set to use cpu
[type: PHONE_NUMBER, start: 36, end: 47, score: 0.4]
text: 私は田中太郎。住所は279-0031 千葉県浦安市舞浜1−1。電話番号は<PHONE_NUMBER>。マイナンバーは123456789012。
items:
[
{'start': 36, 'end': 50, 'entity_type': 'PHONE_NUMBER', 'text': '<PHONE_NUMBER>', 'operator': 'replace'}
]電話番号はマスクされたが、他はダメ。
NERモデルを日本語対応のものに変更してみる

日本語トークナイザをダウンロードしておく。
python -m spacy download ja_core_news_smmodel_config = [{"lang_code": "ja", "model_name": {
"spacy": "ja_core_news_sm",
"transformers": r"H:\BERT_Models\tsmatz\xlm-roberta-ner-japanese"
}
}]
nlp_engine = TransformersNlpEngine(models=model_config)
analyzer = AnalyzerEngine(nlp_engine=nlp_engine)
results = analyzer.analyze(text=text, language='ja')
print(results)
anonymizer = AnonymizerEngine()
anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results)
print(anonymized_text)↓実行結果
Device set to use cpu
[type: LOCATION, start: 19, end: 21, score: 0.9985260963439941]
text: 私は田中太郎。住所は279-0031 <LOCATION>県浦安市舞浜1−1。電話番号は03-999-9999。マイナンバーは123456789012。
items:
[
{'start': 19, 'end': 29, 'entity_type': 'LOCATION', 'text': '<LOCATION>', 'operator': 'replace'}
]
c:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages\transformers\pipelines\token_classification.py:490: UserWarning: Tokenizer does not support real words, using fallback heuristic
warnings.warn(千葉はマスクされたが、他がダメ。
ginzaを使ってみる
pip install -U ginza ja_ginzaimport spacy
import ginza
# GiNZAのcompound_splitterはsplit_mode未指定だとエラーになるため、
# spacy.load を一時的にラップしてconfigを注入する
_original_spacy_load = spacy.load
def _patched_spacy_load(name, *args, **kwargs):
if name == "ja_ginza" and "config" not in kwargs:
kwargs["config"] = {"components": {"compound_splitter": {"split_mode": "A"}}}
return _original_spacy_load(name, *args, **kwargs)
spacy.load = _patched_spacy_load
from presidio_analyzer import AnalyzerEngine
from presidio_analyzer.nlp_engine import TransformersNlpEngine
from presidio_anonymizer import AnonymizerEngine
model_config = [{"lang_code": "ja", "model_name": {
"spacy": "ja_ginza", # ← ja_core_news_sm から変更
"transformers": r"H:\BERT_Models\tsmatz\xlm-roberta-ner-japanese"
}
}]
nlp_engine = TransformersNlpEngine(models=model_config)
analyzer = AnalyzerEngine(nlp_engine=nlp_engine)
results = analyzer.analyze(text=text, language='ja')
print(results)
anonymizer = AnonymizerEngine()
anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results)
print(anonymized_text)↓実行結果
Device set to use cpu
[type: LOCATION, start: 19, end: 27, score: 0.9985260963439941]
text: 私は田中太郎。住所は279-0031 <LOCATION>1−1。電話番号は03-999-9999。マイナンバーは123456789012。
items:
[
{'start': 19, 'end': 29, 'entity_type': 'LOCATION', 'text': '<LOCATION>', 'operator': 'replace'}
]
c:\ProgramData\anaconda3\envs\presidio_20260831\Lib\site-packages\transformers\pipelines\token_classification.py:490: UserWarning: Tokenizer does not support real words, using fallback heuristic
warnings.warn(カスタムレコグナイザーでなんとかする
import spacy
import ginza
if not getattr(spacy.load, "_ja_ginza_patched", False):
_original_spacy_load = spacy.load
def _make_patched_load(original_load):
def _patched(name, *args, **kwargs):
if name == "ja_ginza":
# "disable" は生成はするが実行しないだけなので、
# compound_splitter の split_mode 検証エラーを避けられない。
# "exclude" ならコンポーネント自体を生成しないため、この問題を回避できる。
exclude = list(kwargs.get("exclude", []))
for comp in ("compound_splitter", "bunsetu_recognizer"):
if comp not in exclude:
exclude.append(comp)
kwargs["exclude"] = exclude
kwargs.pop("config", None)
return original_load(name, *args, **kwargs)
_patched._ja_ginza_patched = True
return _patched
spacy.load = _make_patched_load(_original_spacy_load)
from presidio_analyzer import AnalyzerEngine, Pattern, PatternRecognizer, RecognizerRegistry
from presidio_analyzer.nlp_engine import TransformersNlpEngine, NerModelConfiguration
from presidio_anonymizer import AnonymizerEngine
# ============================================================
# NLPエンジン設定(GiNZA + xlm-roberta-ner-japanese)
# ============================================================
model_config = [{"lang_code": "ja", "model_name": {
"spacy": "ja_ginza",
"transformers": r"H:\BERT_Models\tsmatz\xlm-roberta-ner-japanese"
}
}]
ner_model_configuration = NerModelConfiguration(
model_to_presidio_entity_mapping={
"PER": "PERSON",
"PERSON": "PERSON",
"LOC": "LOCATION",
"GPE": "LOCATION",
"ORG": "ORGANIZATION",
"DAT": "DATE_TIME",
"DATE": "DATE_TIME",
"TIM": "DATE_TIME",
"TIME": "DATE_TIME",
"MONEY": "MONEY",
"PERCENT": "PERCENT",
},
low_confidence_score_multiplier=0.4,
low_score_entity_names=["ORGANIZATION"],
alignment_mode="expand",
aggregation_strategy="simple", # 日本語(スペース無し)では"average"等だと、空白ベースのフォールバック判定が誤動作するため"simple"を使う
)
nlp_engine = TransformersNlpEngine(
models=model_config,
ner_model_configuration=ner_model_configuration,
)
nlp_engine.load()
# ============================================================
# カスタムレコグナイザー: 郵便番号・マイナンバー
# ============================================================
postal_recognizer = PatternRecognizer(
supported_entity="JP_POSTAL_CODE",
patterns=[Pattern(name="jp_postal_code", regex=r"\b\d{3}-\d{4}\b", score=0.85)],
context=["郵便番号", "〒"],
supported_language="ja",
)
my_number_recognizer = PatternRecognizer(
supported_entity="JP_MY_NUMBER",
patterns=[Pattern(name="jp_my_number", regex=r"(?<!\d)\d{12}(?!\d)", score=0.3)],
context=["マイナンバー", "個人番号"],
supported_language="ja",
)
# ============================================================
# レジストリ構築(既定 + カスタムを統合)
# ============================================================
registry = RecognizerRegistry(supported_languages=["ja"])
registry.load_predefined_recognizers(nlp_engine=nlp_engine, languages=["ja"])
registry.add_recognizer(postal_recognizer)
registry.add_recognizer(my_number_recognizer)
analyzer = AnalyzerEngine(
nlp_engine=nlp_engine,
registry=registry,
supported_languages=["ja"],
)
# ============================================================
# 実行
# ============================================================
results = analyzer.analyze(text=text, language='ja')
print(results)
anonymizer = AnonymizerEngine()
anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results)
print(anonymized_text)↓実行結果
Device set to use cpu
[type: PERSON, start: 2, end: 6, score: 0.999563992023468, type: LOCATION, start: 10, end: 30, score: 0.998464047908783, type: JP_POSTAL_CODE, start: 39, end: 47, score: 0.85, type: JP_MY_NUMBER, start: 55, end: 67, score: 0.6499999999999999, type: PHONE_NUMBER, start: 36, end: 47, score: 0.4]
text: 私は<PERSON>。住所は<LOCATION>。電話番号は<PHONE_NUMBER>。マイナンバーは<JP_MY_NUMBER>。
items:
[
{'start': 52, 'end': 66, 'entity_type': 'JP_MY_NUMBER', 'text': '<JP_MY_NUMBER>', 'operator': 'replace'},
{'start': 30, 'end': 44, 'entity_type': 'PHONE_NUMBER', 'text': '<PHONE_NUMBER>', 'operator': 'replace'},
{'start': 14, 'end': 24, 'entity_type': 'LOCATION', 'text': '<LOCATION>', 'operator': 'replace'},
{'start': 2, 'end': 10, 'entity_type': 'PERSON', 'text': '<PERSON>', 'operator': 'replace'}
]画像
テストに使った画像。

サンプルコードのまま
import pytesseract
from presidio_image_redactor import ImageRedactorEngine
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
image = Image.open(r"D:\Workspace\Python\Presidio\pii_test_document.png")
redactor = ImageRedactorEngine()
redacted_image = redactor.redact(image=image, ocr_kwargs={"lang": "jpn"})
# オリジナル表示
display(image)
display(redacted_image)
カスタムレコグナイザーあり
import spacy
import ginza
if not getattr(spacy.load, "_ja_ginza_patched", False):
_original_spacy_load = spacy.load
def _make_patched_load(original_load):
def _patched(name, *args, **kwargs):
if name == "ja_ginza":
exclude = list(kwargs.get("exclude", []))
for comp in ("compound_splitter", "bunsetu_recognizer"):
if comp not in exclude:
exclude.append(comp)
kwargs["exclude"] = exclude
kwargs.pop("config", None)
return original_load(name, *args, **kwargs)
_patched._ja_ginza_patched = True
return _patched
spacy.load = _make_patched_load(_original_spacy_load)
from presidio_analyzer import AnalyzerEngine, Pattern, PatternRecognizer, RecognizerRegistry
from presidio_analyzer.nlp_engine import TransformersNlpEngine, NerModelConfiguration
from presidio_image_redactor import ImageRedactorEngine, ImageAnalyzerEngine
import pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
# ============================================================
# 日本語NLPエンジン(GiNZA + xlm-roberta-ner-japanese)
# ============================================================
model_config = [{"lang_code": "ja", "model_name": {
"spacy": "ja_ginza",
"transformers": r"H:\BERT_Models\tsmatz\xlm-roberta-ner-japanese"
}
}]
ner_model_configuration = NerModelConfiguration(
model_to_presidio_entity_mapping={
"PER": "PERSON", "PERSON": "PERSON",
"LOC": "LOCATION", "GPE": "LOCATION",
"ORG": "ORGANIZATION",
"DAT": "DATE_TIME", "DATE": "DATE_TIME",
"TIM": "DATE_TIME", "TIME": "DATE_TIME",
"MONEY": "MONEY", "PERCENT": "PERCENT",
},
low_confidence_score_multiplier=0.4,
low_score_entity_names=["ORGANIZATION"],
alignment_mode="expand",
aggregation_strategy="simple",
)
nlp_engine = TransformersNlpEngine(models=model_config, ner_model_configuration=ner_model_configuration)
nlp_engine.load()
# ============================================================
# カスタムレコグナイザー(郵便番号・マイナンバー)
# ============================================================
postal_recognizer = PatternRecognizer(
supported_entity="JP_POSTAL_CODE",
patterns=[Pattern(name="jp_postal_code", regex=r"\b\d{3}-\d{4}\b", score=0.85)],
context=["郵便番号", "〒"],
supported_language="ja",
)
my_number_recognizer = PatternRecognizer(
supported_entity="JP_MY_NUMBER",
patterns=[Pattern(name="jp_my_number", regex=r"(?<!\d)\d{12}(?!\d)", score=0.3)],
context=["マイナンバー", "個人番号"],
supported_language="ja",
)
registry = RecognizerRegistry(supported_languages=["ja"])
registry.load_predefined_recognizers(nlp_engine=nlp_engine, languages=["ja"])
registry.add_recognizer(postal_recognizer)
registry.add_recognizer(my_number_recognizer)
analyzer = AnalyzerEngine(nlp_engine=nlp_engine, registry=registry, supported_languages=["ja"])
# ============================================================
# 画像レダクター: 日本語analyzerを明示的に組み込む
# ============================================================
image_analyzer_engine = ImageAnalyzerEngine(analyzer_engine=analyzer)
redactor = ImageRedactorEngine(image_analyzer_engine=image_analyzer_engine)
image = Image.open(r"D:\Workspace\Python\Presidio\pii_test_document.png")
redacted_image = redactor.redact(
image=image,
ocr_kwargs={"lang": "jpn"},
language="ja",
)
redacted_image
「田」が貫通しているが、これが限界かなぁ。
以上!



コメント