BerriAI/litellm · error · Exception

\033[91mLangfuse not installed, try running 'pip install lan

Error message

\033[91mLangfuse not installed, try running 'pip install langfuse' to fix this error: {e}\n\033[0m

What it means

Dependency guard in Langfuse prompt management: importing the langfuse package raised ImportError, meaning the optional dependency is not installed in this environment; the message includes the pip command to fix it.

Source

Thrown at litellm/integrations/langfuse/langfuse_prompt_management.py:69

    Initialize Langfuse client with caching to prevent multiple initializations.

    Args:
        langfuse_public_key (str, optional): Public key for Langfuse. Defaults to None.
        langfuse_secret (str, optional): Secret key for Langfuse. Defaults to None.
        langfuse_host (str, optional): Host URL for Langfuse. Defaults to None.
        flush_interval (int, optional): Flush interval in seconds. Defaults to 1.

    Returns:
        Langfuse: Initialized Langfuse client instance

    Raises:
        Exception: If langfuse package is not installed
    """
    try:
        import langfuse
        from langfuse import Langfuse
    except Exception as e:
        raise Exception(
            f"\033[91mLangfuse not installed, try running 'pip install langfuse' to fix this error: {e}\n\033[0m"
        )

    public_key, secret_key, langfuse_host = resolve_langfuse_credentials(
        langfuse_public_key=langfuse_public_key,
        langfuse_secret=langfuse_secret,
        langfuse_secret_key=langfuse_secret_key,
        langfuse_host=langfuse_host,
        allow_env_credentials=allow_env_credentials,
    )

    if not (langfuse_host.startswith("http://") or langfuse_host.startswith("https://")):
        # add http:// if unset, assume communicating over private network - e.g. render
        langfuse_host = "http://" + langfuse_host

    langfuse_release: Final = os.getenv("LANGFUSE_RELEASE")
    langfuse_debug: Final = os.getenv("LANGFUSE_DEBUG")

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Install langfuse with: pip install langfuse.

Example fix

pip install langfuse
Defensive patterns

Strategy: validation

When it happens

Trigger: Using Langfuse prompt management without the langfuse package importable.

Common situations: Missing optional dependency or a broken langfuse installation.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/25e11445eeecb92e. Report an issue: GitHub.