Optional dependencies¶
Brief overview¶
OCDocker splits Python dependencies into a minimal core and optional extras. Install only what your workflow needs; add extras when a command or module requires heavier libraries.
Cheat sheet
pip install ocdocker # minimal core
pip install "ocdocker[docking]" # vs / pipeline
pip install "ocdocker[db]" # --store-db
pip install "ocdocker[ml]" # OCScore ML
pip install "ocdocker[analysis]" # plots / statistics
pip install "ocdocker[workflow]" # Snakemake
pip install "ocdocker[all]" # all runtime stacks
pip install "ocdocker[full]" # all runtime + docs build
pip install "ocdocker[dev]" # pytest, mypy, ruff
pip install -e ".[all,dev]" # typical developer setup
Typical combinations
Single-engine docking →
ocdocker[docking]Multi-engine pipeline with dendrogram PNG →
ocdocker[docking,analysis]OCScore replication →
ocdocker[ml](oftenocdocker[all]for full parity)Editable development →
pip install -e ".[all,dev]"
If a command fails with ModuleNotFoundError, the CLI suggests the matching
extra (for example pip install "ocdocker[ml]" for missing torch).
See Installation for conda/system prerequisites and Usage for CLI workflows that depend on each extra.
Design and rationale¶
Why a lightweight core?¶
pip install ocdocker should work quickly in CI, headless servers, and
environments where you only need configuration, manifests, or doctor checks.
Scientific stacks (RDKit, PyTorch, matplotlib) are large, platform-sensitive, and
not needed to import the base package or run ocdocker --help.
The core therefore includes only utilities shared across many code paths:
Package |
Role in OCDocker |
|---|---|
|
CLI/config parsing helpers |
|
Serialization for masks and sklearn-style artifacts in OCScore I/O |
|
Version and distribution metadata |
|
Structured configuration (reserved for typed settings) |
|
YAML configuration files ( |
|
HTTP downloads and remote resources |
|
Optional enhanced console logging (falls back to stdlib logging) |
|
Progress bars in processing and download utilities |
Everything else is grouped by workflow into pip extras defined in
pyproject.toml. Extras can overlap (numpy appears in docking, ml,
and analysis); pip deduplicates installed packages.
Lazy imports and CLI hints¶
Optional modules are imported only when you run the matching command or import the matching submodule. If a dependency is missing, the CLI prints a short hint such as:
Error: missing optional dependency 'torch' required for OCScore pipeline.
Install with: pip install "ocdocker[ml]"
Plotting in RMSD clustering uses lazy matplotlib imports; clustering itself
runs with [docking] only, while dendrogram PNG output needs [analysis].
Extra reference¶
Runtime extras¶
dockingChemistry and the numeric stack for virtual screening and pipeline clustering.
Chemistry:
rdkit,openbabel-wheel,biopython,spyrmsdNumeric / clustering:
numpy,pandas,scipy,scikit-learn
Required for
ocdocker vs,ocdocker pipeline, and Python imports such asOCDocker.LigandandOCDocker.Receptor.dbSQLAlchemy and database drivers for PostgreSQL and MySQL.
sqlalchemy,sqlalchemy-utils,psycopg,pymysql
Required when using
--store-dborOCDocker.DBagainst server backends. SQLite is recommended for development/testing/small local runs; PostgreSQL/MySQL are recommended for persistent, concurrent, or long-running workflows. Missing DB drivers report the install hintpip install "ocdocker[db]".mlOCScore machine-learning pipeline (PyTorch, XGBoost, Optuna).
Frameworks:
torch,torchaudio,torchvision,xgboostTuning / viz:
optuna,optuna-dashboard,optuna-integration,torchsummary,torchviz,visualtorchShared numeric stack:
numpy,pandas,scipy,scikit-learn
Required for
ocdocker ocscoreandOCDocker.OCScoretraining/export paths.analysisPlotting, statistics, explainability, and extended scientific I/O.
Plotting:
matplotlib,seaborn,graphvizStatistics / explainability:
statsmodels,pingouin,dcor,lime,shapGraphs / imaging:
networkx,rustworkx,scikit-image,h5py,imageio,pillow,tifffileNotebook / symbolic:
ipython,sympy,mpmath,gmpy2Acceleration / utilities:
numba,llvmlite,fsspecNumeric (standalone analysis installs):
numpy,pandas,scipy
Required for OCScore plotting/SHAP visualization, statistical reports, and pipeline dendrogram PNGs (
clustering_dendrogram.png). Clustering math itself lives in[docking]; plots live in[analysis].workflowSnakemake integration and logging plugins. Also enables the
vs_campaignjob kind’sengine="snakemake"option (real DAG orchestration for multi-sample batches, see OCDocker.Workbench package and OCDocker.MCP package) — invoked aspython -m snakemakeagainst the same interpreter runningocdocker workbench serve, not a baresnakemakeresolved fromPATH.snakemake,snakemake-logger-plugin-snkmt
cloudOptional cloud storage backends.
boto3,google-cloud-storage,dropbox
gpuGPU array acceleration (non-macOS).
cupy-cuda11x(platform marker excludes Darwin)
apiFastAPI/uvicorn stack for the Workbench HTTP API.
fastapi,uvicorn
Required for
ocdocker workbench serve. The Workbench browser dashboard and JSON API are unavailable without this extra.mcpMCP server exposing the Workbench API to LLM clients (Claude Code, Claude Desktop, …) over stdio.
mcp
Required for
ocdocker mcp serve. Requires a runningocdocker workbench serveinstance to connect to.
Aggregate and tooling extras¶
allUnion of runtime extras:
docking+db+ml+analysis+workflow+cloud+gpu+api+mcp. Use when you want every runtime feature without documentation build tools.fullallplusdocs(Sphinx, Furo, MyST, themes). Use to build this documentation locally withmake -C docs html.docsSphinx documentation build only (subset of
full).devDeveloper tooling:
pytest,pytest-cov,pytest-order,coverage,mypy,ruff,pre-commit,detect-secrets. Combine with runtime extras, e.g.pip install -e ".[all,dev]".buildPyPI release tooling:
build,twine,wheel,setuptools.
Command and feature map¶
User action |
Recommended install |
Notes |
|---|---|---|
|
core only |
No scientific stack required |
|
core; add extras for full dep checks |
Doctor reports missing optional imports |
|
|
RDKit/OpenBabel at ligand import time |
|
|
RMSD clustering uses sklearn/scipy |
|
|
Matplotlib loaded lazily when plotting |
|
add |
SQLAlchemy + driver for your backend |
|
|
PyTorch/Optuna/XGBoost stack |
OCScore plots / SHAP exports |
|
Seaborn/matplotlib in analysis modules |
Snakemake workflows |
|
External |
|
|
FastAPI/uvicorn; dashboard is unavailable without it |
|
|
Connects to a running |
Local Sphinx docs |
|
See Installation |
Running the test suite |
|
Tests import docking/db/ml modules |
Combining extras¶
List multiple extras in one install command:
pip install "ocdocker[docking,db,ml]"
Editable installs from a git checkout use the same syntax:
pip install -e ".[docking,analysis]"
Upgrading from older installs¶
Earlier releases installed many scientific packages as core dependencies. Current releases move them into extras:
Previously in core |
Now install via |
|---|---|
|
|
|
|
|
|
|
|
|
|
If scripts break after upgrading, install the extras your workflow used implicitly
before, or switch to [all] for parity with a full historical environment.
requirements.txt in the repository root mirrors core only; optional stacks
are selected via pip extras, not a monolithic requirements file. Packaged YAML
protocols and Workbench static assets are declared under
[tool.setuptools.package-data] in pyproject.toml (see
Bundled OCScore protocol data).
Troubleshooting¶
- ``ModuleNotFoundError`` after upgrade
Install the extra suggested in the CLI message. For Python API use, import the submodule only after installing the matching extra.
- Pipeline runs but no dendrogram PNG
Install
[analysis]. Without matplotlib, clustering completes but plot generation is skipped with a warning.- ``ocdocker –help`` works but docking fails
Expected: help does not require RDKit. Run
pip install "ocdocker[docking]".- CI / reproducible environments
Pin extras explicitly in your environment file, e.g.
pip install "ocdocker[all,dev]", rather than relying on transitive pins from an old monolithic core.- Source of truth
Extras and version constraints are defined in
pyproject.tomlunder[project.dependencies]and[project.optional-dependencies]. Packaging tests intests/cli/test_packaging_metadata.pykeeprequirements.txtaligned with the core list.
Contributor formatting rules (line length 120, multiline TOML, long Python list constants) are in Development conventions.