xtekky/gpt4free · error · MissingRequirementsError
Install "zendriver" and "platformdirs" package | pip install
Error message
Install "zendriver" and "platformdirs" package | pip install -U zendriver platformdirs
What it means
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.
Source
Thrown at g4f/requests/__init__.py:276
else:
for key, value in response.cookies.items():
cookies[key] = value
return cookies
def set_browser_executable_path(browser_executable_path: str):
BrowserConfig.browser_executable_path = browser_executable_path
async def get_nodriver(
proxy: str = None,
user_data_dir="nodriver",
timeout: int = 300,
browser_executable_path: str = None,
**kwargs,
) -> tuple[Browser, Callable]:
if not has_nodriver:
raise MissingRequirementsError(
'Install "zendriver" and "platformdirs" package | pip install -U zendriver platformdirs'
)
user_data_dir = (
user_config_dir(f"g4f-{user_data_dir}")
if user_data_dir and has_platformdirs
else None
)
if browser_executable_path is None:
browser_executable_path = BrowserConfig.executable_path
if browser_executable_path is None:
try:
browser_executable_path = find_executable()
except FileNotFoundError:
# Default to Edge if Chrome is not available.
browser_executable_path = (
"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"
)
if not os.path.exists(browser_executable_path):View on GitHub (pinned to 973504e177)
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.
Defensive patterns
Strategy: validation
Validate before calling
from g4f.requests import has_nodriver, has_platformdirs
if not has_nodriver:
raise SystemExit('Install first: pip install -U zendriver platformdirs') Try / catch
from g4f.errors import MissingRequirementsError
try:
browser, stop = await get_nodriver()
except MissingRequirementsError as e:
print(e) # surface the pip command to the operator Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Installing only `g4f` without the browser extras; a virtualenv created from a requirements list that omitted zendriver; a CI image stripped to minimal dependencies.
Related errors
- Nodriver is already in use, please try again later.
- {captcha}
- The Qwen provider reached the limit Cloudflare.
- hCaptcha accessibility cookie required: log in at https://da
- No audio chunks received from ElevenLabs.
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/fbbf96e532a42829.
Report an issue: GitHub.