Installation¶
PyOD 3 ships as a single pip-installable library plus optional agent activation paths. This guide covers every install variant, from a minimal core install to the full agentic stack.
Quickstart¶
Core library (required for every activation path):
pip install pyod
Then pick the activation path that matches your agent stack:
# 1. Claude Code / Codex — enables the od-expert skill
pyod install skill # Claude Code: installs to ~/.claude/skills/
pyod install skill --project # Codex: installs to ./skills/ in the project
# 2. Any MCP-compatible LLM — requires the optional mcp extra
pip install pyod[mcp]
pyod mcp serve # alias for `python -m pyod.mcp_server`
# 3. Pure Python — no extra step
# from pyod.utils.ad_engine import ADEngine
Run pyod info at any time to see version, detector counts, and the install state of each activation path.
Core library install¶
PyOD is distributed through both pip (PyPI) and conda (conda-forge). We recommend the latest version due to frequent updates:
pip install pyod # normal install
pip install --upgrade pyod # upgrade if already installed
conda users can install from conda-forge:
conda install -c conda-forge pyod
To install from source (useful for development):
git clone https://github.com/yzhao062/pyod.git
cd pyod
pip install .
Agentic activation paths¶
PyOD 3 supports three activation paths for AI agents. Pick the one that matches your agent stack; you can enable more than one in the same environment.
- Claude Code
The
od-expertskill ships as package data inside the pyod wheel and is copied into Claude Code’s skill directory via thepyod install skillcommand:pip install pyod pyod install skill # user-global → ~/.claude/skills/od-expert/ pyod install skill --project # project-local → ./skills/od-expert/ pyod install skill --list # list available packaged skills pyod install skill --target <path> # custom destination
After installing, run
pyod infoto confirm the skill is detected. The legacypyod-install-skillcommand from v3.0.0 is kept as a backward-compat alias and shares a single code path withpyod install skill.- Codex users
Codex does not have a user-global skill directory like Claude Code. It reads shared skills from
./skills/<skill-name>/in the project root, which is exactly the pathpyod install skill --projectwrites to. From a project directory, run:pyod install skill --project
Codex picks up
od-expertin that project automatically.pyod infodetects~/.codex/and reports Codex alongside Claude Code in its output.- MCP-compatible agents
The MCP server exposes PyOD tools to any MCP-compatible LLM (e.g., Claude Desktop via MCP, other agent frameworks). It requires the optional
mcpextra:pip install pyod[mcp] pyod mcp serve # alias for ``python -m pyod.mcp_server``
The server registers ten stateless tools:
profile_data,plan_detection,build_detector,list_detectors,explain_detector,compare_detectors,get_benchmarks,run_detection,analyze_results, andexplain_findings.Claude Desktop connects through this path: it reads MCP servers and has no skill directory, so
pyod install skilldoes not reach it.- Python apps / custom agents
Import and call PyOD’s orchestration layer directly:
from pyod.utils.ad_engine import ADEngine engine = ADEngine() state = engine.investigate(X_train)
No extra install step beyond
pip install pyod. See the Layer 3: Agentic Investigation walkthrough for a full conversation example.
Verifying your install¶
Run pyod info to check version, detector counts, and the install state of every activation path:
pyod info
Example output:
PyOD version: 3.1.0
Detectors (ADEngine): 61 total (43 tabular, 7 time-series, 8 graph, 2 text, 2 image, 1 multimodal, 3 audio)
Classic API: OK
ADEngine (Layer 2): OK
MCP extra: OK (run: pyod mcp serve)
od-expert skill: INSTALLED (user-global) at /Users/you/.claude/skills/od-expert/SKILL.md
If the od-expert skill line reads NOT INSTALLED but Claude Code is detected, run pyod install skill. If the MCP extra shows NOT INSTALLED and you want MCP access, run pip install pyod[mcp].
Required dependencies¶
Python 3.9 or higher
joblibmatplotlibnumpy>=1.19numba>=0.51scipy>=1.5.1scikit-learn>=0.22.0
Optional dependencies¶
Every optional feature ships as a pip extra. Install only what you need, or take the whole stack at once:
pip install pyod[torch] # one extra
pip install pyod[torch,graph] # several at once
pip install pyod[all] # every optional dependency
The extra names in the first column below are the only valid ones, and they are matched exactly. pip treats an unrecognized extra as a warning rather than an error, so pip install pyod[pytorch] exits successfully having installed PyOD itself but none of the PyTorch stack the name suggests, and the mistake only surfaces later as an ImportError. The extra that carries PyTorch is torch. On zsh, quote the argument (pip install 'pyod[all]') so the shell does not expand the brackets.
Extra |
Installs |
Enables |
|---|---|---|
|
|
Neural detectors: AutoEncoder, VAE, DeepSVDD |
|
|
SUOD acceleration framework |
|
|
XGBOD supervised detector |
|
|
Model combination, FeatureBagging |
|
|
Data-driven thresholding |
|
|
EmbeddingOD text detection |
|
|
EmbeddingOD with OpenAI embeddings |
|
|
EmbeddingOD image, HuggingFace encoder |
|
|
Graph detectors (DOMINANT, CoLA, and the rest) |
|
|
MCP server for MCP-compatible agents |
|
|
|
|
Every package listed above |
The full stack in one command |
Warning
PyOD includes several neural-network-based models, including AutoEncoders, VAE, DeepSVDD, and the graph detectors (DOMINANT, CoLA, etc.), all implemented in PyTorch. These deep learning libraries are not installed with the core package, so installing PyOD without an extra leaves an existing PyTorch installation untouched. For most users the extras are the shortest path: pip install pyod[torch] for the neural detectors and pip install pyod[graph] for the graph models, both of which pull a default PyTorch build from PyPI. Installing PyTorch separately still matters when you need a build other than the PyPI default, such as a CPU-only wheel or a particular CUDA or ROCm version. Those variants come from PyTorch’s own package index, whose URL the selector at pytorch.org generates for you. In that case install PyTorch first; a later pip install pyod[torch] leaves an already-satisfied torch>=2.0 untouched. Similarly, xgboost is not installed by default but is required for XGBOD (pip install pyod[xgboost]).