{"record":{"id":"06a13fb123cb6883","repo":"BerriAI/litellm","slug":"91mlangfuse-not-installed-try-running-pip-inst-06a13f","errorCode":null,"errorMessage":"\u001b[91mLangfuse not installed, try running 'pip install langfuse' to fix this error: {e}\\n\u001b[0m","messagePattern":"\u001b\\[91mLangfuse not installed, try running 'pip install langfuse' to fix this error: (.+?)\\\\n\u001b\\[0m","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/langfuse/langfuse_prompt_management.py","lineNumber":69,"sourceCode":"    Initialize Langfuse client with caching to prevent multiple initializations.\n\n    Args:\n        langfuse_public_key (str, optional): Public key for Langfuse. Defaults to None.\n        langfuse_secret (str, optional): Secret key for Langfuse. Defaults to None.\n        langfuse_host (str, optional): Host URL for Langfuse. Defaults to None.\n        flush_interval (int, optional): Flush interval in seconds. Defaults to 1.\n\n    Returns:\n        Langfuse: Initialized Langfuse client instance\n\n    Raises:\n        Exception: If langfuse package is not installed\n    \"\"\"\n    try:\n        import langfuse\n        from langfuse import Langfuse\n    except Exception as e:\n        raise Exception(\n            f\"\\033[91mLangfuse not installed, try running 'pip install langfuse' to fix this error: {e}\\n\\033[0m\"\n        )\n\n    public_key, secret_key, langfuse_host = resolve_langfuse_credentials(\n        langfuse_public_key=langfuse_public_key,\n        langfuse_secret=langfuse_secret,\n        langfuse_secret_key=langfuse_secret_key,\n        langfuse_host=langfuse_host,\n        allow_env_credentials=allow_env_credentials,\n    )\n\n    if not (langfuse_host.startswith(\"http://\") or langfuse_host.startswith(\"https://\")):\n        # add http:// if unset, assume communicating over private network - e.g. render\n        langfuse_host = \"http://\" + langfuse_host\n\n    langfuse_release: Final = os.getenv(\"LANGFUSE_RELEASE\")\n    langfuse_debug: Final = os.getenv(\"LANGFUSE_DEBUG\")\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/langfuse/langfuse_prompt_management.py#L51-L87","documentation":"Same missing-dependency guard as the main Langfuse logger, but in the prompt-management helper (langfuse_client_init). It lazily imports 'langfuse' when LiteLLM needs to fetch a managed prompt, and wraps any import failure in this message. It surfaces when you configure Langfuse as the prompt manager, not at litellm install time.","triggerScenarios":"Setting litellm.prompt_manager = 'langfuse' (or passing a langfuse prompt spec via callbacks) without the langfuse package installed; a broken langfuse install whose import raises due to a dependency conflict.","commonSituations":"Adopting LiteLLM's unified prompt management against Langfuse while only having installed the core litellm package; upgrading pydantic breaks the installed langfuse's imports, which is misread as 'not installed'.","solutions":["pip install langfuse","Verify with python -c 'import langfuse'; if it fails despite being installed, fix the underlying import error shown in the message (typically dependency version conflicts)","Reinstall cleanly if the venv is corrupted: pip install --force-reinstall langfuse","Drop the langfuse prompt manager config if prompt management is not actually needed"],"exampleFix":"# before\nimport litellm\nlitellm.prompt_manager = [\"langfuse\"]  # Exception: Langfuse not installed...\n\n# after\n# shell: pip install langfuse\nimport litellm\nlitellm.prompt_manager = [\"langfuse\"]","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"langfuse\") is None:\n    raise RuntimeError(\"langfuse package required for prompt management; pip install langfuse\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check optional deps before enabling prompt management","Keep langfuse in the deploy requirements when prompt_manager uses it","Test the integration in CI with the same dependency set as production"],"tags":["python","langfuse","dependency","prompt-management"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}