langchain-ai/deepagents · error · ImportError
Local voice transcription dependencies are missing. Install
Error message
Local voice transcription dependencies are missing. Install the `media` extra and ensure ffmpeg is on PATH.
What it means
Local voice transcription uses Hugging Face `transformers` (loaded lazily via importlib) to build an automatic-speech-recognition pipeline. If `transformers` is not installed, `_load_local_pipeline` raises this ImportError pointing to the `media` extra and ffmpeg. It is a deliberate, explanatory error for an optional dependency set.
Source
Thrown at libs/talon/deepagents_talon/speech.py:253
wav_path.unlink(missing_ok=True)
except OSError:
logger.debug("Could not delete temporary voice transcription file: %s", wav_path)
def _load_local_pipeline(model: str, device: str) -> _LocalSpeechPipeline:
key = (model, device)
cached = _local_pipelines.get(key)
if cached is not None:
return cached
try:
module = importlib.import_module("transformers")
except ImportError as exc:
msg = (
"Local voice transcription dependencies are missing. Install the `media` "
"extra and ensure ffmpeg is on PATH."
)
raise ImportError(msg) from exc
logger.info("Loading local voice transcription model %s on device=%s", model, device)
loaded = module.pipeline(
"automatic-speech-recognition",
model=model,
device=device,
)
_local_pipelines[key] = loaded
logger.info("Local voice transcription model %s ready on device=%s", model, device)
return loaded
def _pipeline_text(result: object) -> str:
if isinstance(result, Mapping):
values = cast("Mapping[str, object]", result)
text = values.get("text")
return text.strip() if isinstance(text, str) else ""
text = getattr(result, "text", None)View on GitHub (pinned to a1af029e6e)
Solutions
- Install the extra: `pip install "deepagents-talon[media]"` (or `uv sync --extra media`)
- Verify with `python -c "import transformers"` that the import works in the target environment
- Alternatively configure a cloud/API transcription backend that does not need the local pipeline
Example fix
# before pip install deepagents-talon # after pip install "deepagents-talon[media]"
Defensive patterns
Strategy: fallback
Validate before calling
import importlib.util
if importlib.util.find_spec("transformers") is None:
raise SystemExit("Install the media extra: pip install 'deepagents-talon[media]'") Try / catch
try:
text = transcribe_local(path)
except ImportError as exc:
if "media" in str(exc):
text = transcribe_cloud(path) # fallback backend
else:
raise Prevention
- Always install the `media` extra in environments that do local transcription
- Add a CI check importing transformers in the deployment image
- Document the extra in setup scripts and Dockerfiles
When it happens
Trigger: Requesting local (non-API) transcription of an audio file when the `transformers` package (part of the `media` extra) is absent from the environment.
Common situations: Installing talon without `pip install deepagents-talon[media]`; running in a slim Docker image that trimmed ML dependencies; switching from a cloud transcription backend to local transcription in a fresh venv.
Understand the failure class
Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.
Related errors
- Invalid class_path '{class_path}' for provider '{provider}':
- Could not import module '{module_path}' for provider '{provi
- Class '{class_name}' not found in module '{module_path}' for
- Provider package '{package}' is installed but failed to impo
- Entry point {entry.name!r} does not resolve to a Python modu
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/17f22f9191b886d1.
Report an issue: GitHub.