{"record":{"id":"fbbf96e532a42829","repo":"xtekky/gpt4free","slug":"install-zendriver-and-platformdirs-package-p","errorCode":null,"errorMessage":"Install \"zendriver\" and \"platformdirs\" package | pip install -U zendriver platformdirs","messagePattern":"Install \"zendriver\" and \"platformdirs\" package \\| pip install -U zendriver platformdirs","errorType":"exception","errorClass":"MissingRequirementsError","httpStatus":null,"severity":"error","filePath":"g4f/requests/__init__.py","lineNumber":276,"sourceCode":"    else:\n        for key, value in response.cookies.items():\n            cookies[key] = value\n    return cookies\n\n\ndef set_browser_executable_path(browser_executable_path: str):\n    BrowserConfig.browser_executable_path = browser_executable_path\n\n\nasync def get_nodriver(\n    proxy: str = None,\n    user_data_dir=\"nodriver\",\n    timeout: int = 300,\n    browser_executable_path: str = None,\n    **kwargs,\n) -> tuple[Browser, Callable]:\n    if not has_nodriver:\n        raise MissingRequirementsError(\n            'Install \"zendriver\" and \"platformdirs\" package | pip install -U zendriver platformdirs'\n        )\n    user_data_dir = (\n        user_config_dir(f\"g4f-{user_data_dir}\")\n        if user_data_dir and has_platformdirs\n        else None\n    )\n    if browser_executable_path is None:\n        browser_executable_path = BrowserConfig.executable_path\n    if browser_executable_path is None:\n        try:\n            browser_executable_path = find_executable()\n        except FileNotFoundError:\n            # Default to Edge if Chrome is not available.\n            browser_executable_path = (\n                \"C:\\\\Program Files (x86)\\\\Microsoft\\\\Edge\\\\Application\\\\msedge.exe\"\n            )\n            if not os.path.exists(browser_executable_path):","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/requests/__init__.py#L258-L294","documentation":"Raised by get_nodriver() in g4f/requests/__init__.py when has_nodriver is False, i.e. `import zendriver` (and its submodules) failed at package import time. g4f uses zendriver (a nodriver fork) to run a real Chromium instance for providers behind Cloudflare; without it the browser-based flow is unavailable. The message tells you exactly which packages to install.","triggerScenarios":"Calling await get_nodriver(...) (directly or via a provider that needs browser automation) when zendriver or platformdirs is not installed. The check happens before any browser launch, so the error is immediate and deterministic per process.","commonSituations":"Installing only `g4f` without the browser extras; a virtualenv created from a requirements list that omitted zendriver; a CI image stripped to minimal dependencies.","solutions":["pip install -U zendriver platformdirs (exactly as the message says), then restart the process.","Verify with `python -c \"import zendriver; import platformdirs\"`.","If zendriver is installed but still fails, check for a conflicting old `nodriver` package and upgrade: pip install -U zendriver.","If browsers are not wanted, stop calling the browser-dependent provider/flow and use an HTTP-only provider."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from g4f.requests import has_nodriver, has_platformdirs\n\nif not has_nodriver:\n    raise SystemExit('Install first: pip install -U zendriver platformdirs')","typeGuard":null,"tryCatchPattern":"from g4f.errors import MissingRequirementsError\n\ntry:\n    browser, stop = await get_nodriver()\nexcept MissingRequirementsError as e:\n    print(e)  # surface the pip command to the operator","preventionTips":["Declare zendriver and platformdirs in your environment spec when using browser flows.","Gate browser-based providers behind a startup capability check on has_nodriver.","Cache the capability result; do not call get_nodriver repeatedly in an env you know lacks it."],"tags":["missing-dependency","zendriver","nodriver","browser-automation"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}