assafelovic/gpt-researcher · error · ImportError

The zendriver package is required to use NoDriverScraper. Pl

Error message

The zendriver package is required to use NoDriverScraper. Please install it with: pip install zendriver

What it means

NoDriverScraper optionally depends on the zendriver package for CDP-based browser automation. Inside the async create_browser() factory, it does 'import zendriver' inside a try block; on ImportError it raises a targeted ImportError telling you to pip install zendriver. This fires the first time a browser instance is requested.

Source

Thrown at gpt_researcher/scraper/browser/nodriver_scraper.py:143

                # Log error but don't block the request
                NoDriverScraper.logger.warning(
                    f"Rate limiting error for {url}: {str(e)}"
                )

        async def stop(self):
            if self.stopping:
                return
            self.stopping = True
            await self.driver.stop()

    @classmethod
    async def get_browser(cls, headless: bool = False) -> "NoDriverScraper.Browser":
        async def create_browser():
            try:
                global zendriver
                import zendriver
            except ImportError:
                raise ImportError(
                    "The zendriver package is required to use NoDriverScraper. "
                    "Please install it with: pip install zendriver"
                )

            config = zendriver.Config(
                headless=headless,
                browser_connection_timeout=10,
            )
            driver = await zendriver.start(config)
            browser = cls.Browser(driver)
            cls.browsers.add(browser)
            return browser

        async with cls.browsers_lock:
            if len(cls.browsers) == 0:
                # No browsers available, create new one
                return await create_browser()

View on GitHub (pinned to 6f998577d5)

Solutions

  1. Install it: pip install zendriver.
  2. If the project exposes an extra, install that instead (e.g., pip install -U gpt-researcher[zendriver]).
  3. Verify the import resolves in the same interpreter: python -c "import zendriver; print(zendriver.__version__)".
  4. If you can't install zendriver, switch the scraper to the selenium-based BrowserScraper and install selenium.

Example fix

# before
browser = await NoDriverScraper.get_browser(headless=True)  # ImportError: ... pip install zendriver

# after
# pip install zendriver
browser = await NoDriverScraper.get_browser(headless=True)
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

if importlib.util.find_spec('zendriver') is None:
    raise SystemExit('zendriver is required for NoDriverScraper: pip install zendriver')

Type guard

def zendriver_available() -> bool:
    try:
        import zendriver  # noqa: F401
        return True
    except ImportError:
        return False

Try / catch

try:
    browser = await NoDriverScraper.get_browser(headless=True)
except ImportError as e:
    if 'zendriver' in str(e):
        scraper = BrowserScraper(url)  # selenium fallback
    else:
        raise

Prevention

When it happens

Trigger: Awaiting NoDriverScraper.get_browser(...) (directly or by scraping a URL with NoDriverScraper) when zendriver is not importable — not installed, installed in the wrong environment, or a broken install where importing a submodule fails.

Common situations: Choosing the nodriver/zendriver scraper backend without installing its extra; using a venv where only selenium was installed; CI images lacking the package; zendriver renamed or version-locked incorrectly in requirements.txt.

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


AI-assisted analysis of assafelovic/gpt-researcher@6f998577d5 (2026-08-28). Data as JSON: /api/errors/149737f9e29162e7. Report an issue: GitHub.