Skip to content

Environment variables

Juho Inkinen edited this page Aug 7, 2026 · 5 revisions

The following table summarizes environment variables that can be used to configure Annif and some of its supporting features:

Variable Default Description
ANNIF_PROJECTS projects.{cfg,toml,d} Path to the projects configuration file or directory (override with --projects CLI option). Annif uses this to discover and load project definitions. Accepts path to a .cfg or .toml file, or a directory containing such files. See Project Configuration for details.
ANNIF_DATADIR data Directory for storing vocabularies, models, and other data files. Specifies the directory where Annif stores its data files, including loaded vocabularies and trained models. Accepts absolute or relative path.
ANNIF_PROJECTS_INIT .* (match all) Regular expression pattern to filter which projects are initialized at startup. Only projects whose IDs match this pattern will be initialized. Useful in deployments with multiple instances where you want to control which projects are loaded in each instance.
ANNIF_MAX_FORM_MEMORY_SIZE 20000000 (20 MB) Maximum size for form data (limits the suggest method of the REST API). Passed to Flask as its MAX_FORM_MEMORY_SIZE setting. Accepts integer value in bytes.
ANNIF_MAX_CONTENT_LENGTH 20000000 (20 MB) Maximum size for request bodies (limits all methods of the REST API). Passed to Flask as its MAX_CONTENT_LENGTH setting. Accepts integer value in bytes.
HF_HOME ~/.cache/huggingface Cache directory for Hugging Face models. Used by the huggingface_hub library via annif download CLI command to specify a cache directory for downloaded models. See Hugging Face Hub integration for more details.

← Optional features and dependencies | Backward compatibility between releases →

Clone this wiki locally