docs/docs/Develop/install-custom-dependencies.mdx
Langflow provides optional dependency groups and support for custom dependencies to extend Langflow functionality. This guide covers how to add dependencies for different Langflow installations, including Langflow Desktop and Langflow OSS.
The Langflow codebase uses three package layers:
langflow) is managed by the root-level pyproject.toml. It depends on langflow-base and adds the curated standalone lfx-* provider extensions.langflow-base) is managed at src/backend/base/pyproject.toml. It provides the UI, API, platform services, and built-in components without provider extension distributions. It depends on lfx.lfx package is managed at src/lfx/pyproject.toml. LFX is a lightweight CLI tool for executing and serving Langflow flows. The lfx package does not provide optional dependency groups for end users.To add dependencies to Langflow Desktop, add an entry for the package to the application's requirements.txt file:
* On macOS, the file is located at `/Users/USER/.langflow/data/requirements.txt`.
* On Windows, the file is located at `C:\Users\USER\AppData\Roaming\com.Langflow\data\requirements.txt`.
Add each dependency to requirements.txt on its own line in the format DEPENDENCY==VERSION, such as matplotlib==3.10.0.
Restart Langflow Desktop to install the dependencies.
If you need to change or uninstall custom dependencies, edit the requirements.txt file, and then restart Langflow Desktop.
To install your own custom dependencies in your Langflow environment, add them with your package manager.
If you're working within a cloned Langflow repository, add dependencies with uv add because there is already a pyproject.toml file for uv to reference:
uv add DEPENDENCY
langflowThe langflow package (main) provides optional dependency groups that extend its functionality.
By default, installing langflow without any extras includes all dependencies listed in the [project.dependencies] section. Optional dependency groups are not installed by default and must be explicitly requested.
These optional dependencies are listed in the langflow pyproject.toml file under [project.optional-dependencies].
Install dependency groups using pip's [extras] syntax. For example, to install langflow with the postgresql dependency group, enter the following command:
uv pip install "langflow[postgresql]"
To install multiple extras, use commas to separate each dependency group:
uv pip install "langflow[postgresql,audio]"
Use the bundles extra to install every no-Torch long-tail bundle plus the
arXiv, DuckDuckGo, EmpirioLabs, Exa, Firecrawl, NextPlaid, Paddle, and Valkey
standalone extensions:
uv pip install "langflow[bundles]"
langflow-baselangflow-base is recommended when you want the runnable Langflow UI and API
without provider extensions. It includes platform services such as Redis,
Chroma, MCP, Kubernetes, object storage, and tracing support. The langflow
package depends on this same version of langflow-base and adds curated
standalone extensions.
The langflow-base package provides its own optional dependency groups that are separate from those in the langflow package. The langflow-base package can be installed as a standalone package with these optional dependency groups.
By default, installing langflow-base without any extras includes all dependencies listed in the [project.dependencies] section. Optional dependency groups are not installed by default and must be explicitly requested.
These optional dependency groups are listed in the langflow-base pyproject.toml file under [project.optional-dependencies].
Install langflow-base with optional dependency groups using pip's [extras] syntax. For example, to install langflow-base with the postgresql dependency group:
uv pip install "langflow-base[postgresql]"
To install multiple extras, use commas to separate each dependency group:
uv pip install "langflow-base[postgresql,cassandra]"
Provider components are installed as extensions. For example, install
lfx-openai beside langflow-base, or use langflow to install the curated
provider set:
uv pip install langflow-base lfx-openai
The base executable is langflow; there is no langflow-base command.
When testing locally, use a virtual environment to isolate your dependencies and prevent conflicts with other Python projects.
For example, if you want to experiment with a custom dependency like matplotlib with Langflow:
# Create and activate a virtual environment
uv venv YOUR_LANGFLOW_VENV
source YOUR_LANGFLOW_VENV/bin/activate
# Install langflow and your additional dependency
uv pip install langflow matplotlib
You can also install langflow-base with specific optional dependency groups in your virtual environment:
# Install runnable base with selected compatibility extras
uv pip install "langflow-base[postgresql,cassandra]" matplotlib
If you're working within a cloned Langflow repository, add dependencies with uv add to reference the existing pyproject.toml files:
uv add matplotlib
The uv add command automatically updates the uv.lock file in the appropriate location.
When contributing to the Langflow codebase, you might need to add dependencies to Langflow.
To add a dependency to the main package, run uv add DEPENDENCY from the project root.
For example:
uv add matplotlib
Dependencies can be added to the main package as regular dependencies at [project.dependencies] or optional dependencies at [project.optional-dependencies].
To add a dependency to the base package, navigate to src/backend/base and run:
uv add DEPENDENCY
To add a development dependency for testing, linting, or debugging, navigate to src/backend/base and run:
cd src/backend/base && uv add --group dev DEPENDENCY
Dependencies can be added to the base package as regular dependencies at [project.dependencies], development dependencies at [dependency-groups.dev], or optional dependencies at [project.optional-dependencies].
You can optionally use make add instead of uv add:
# Equivalent to: uv add matplotlib
make add main="matplotlib"
# Equivalent to: cd src/backend/base && uv add --group dev matplotlib
make add devel="matplotlib"
# Equivalent to: cd src/backend/base && uv add matplotlib
make add base="matplotlib"
Alternatively, you can add these dependencies manually to the appropriate pyproject.toml file:
[project]
dependencies = [
"matplotlib>=3.8.0"
]
Or as an optional dependency in the main package:
[project.optional-dependencies]
plotting = [
"matplotlib>=3.8.0",
]
Or as a development dependency in the base package:
[dependency-groups]
dev = [
"matplotlib>=3.8.0",
]