ScrapeGraphAI/Scrapegraph-ai · error · ImportError

The browserbase module is not installed.

Error message

The browserbase module is not installed.
                                    Please install it using `pip install browserbase`.

What it means

FetchNodeLevelK.fetch_content uses BrowserBase when browser_base config is set; the failure to import scrapegraphai.docloaders.browser_base.browser_base_fetch raises this ImportError with install instructions — same family as error 55 but on the level-k crawling node.

Source

Thrown at scrapegraphai/nodes/fetch_node_level_k.py:121

    def fetch_content(self, source: str, loader_kwargs) -> Optional[str]:
        """
        Fetches the HTML content of a given source URL.

        Args:
            source (str): The URL to fetch content from.
            loader_kwargs (dict): Additional arguments for the content loader.

        Returns:
            Optional[str]: The fetched HTML content or None if fetching failed.
        """
        self.logger.info(f"--- (Fetching HTML from: {source}) ---")

        if self.browser_base is not None:
            try:
                from ..docloaders.browser_base import browser_base_fetch
            except ImportError:
                raise ImportError(
                    """The browserbase module is not installed.
                                    Please install it using `pip install browserbase`."""
                )

            data = browser_base_fetch(
                self.browser_base.get("api_key"),
                self.browser_base.get("project_id"),
                [source],
            )
            document = [
                Document(page_content=content, metadata={"source": source})
                for content in data
            ]
        elif self.scrape_do:
            from ..docloaders.scrape_do import scrape_do_fetch

            data = scrape_do_fetch(self.scrape_do.get("api_key"), source)
            document = [Document(page_content=data, metadata={"source": source})]

View on GitHub (pinned to 532dfffbf6)

Solutions

  1. pip install browserbase and verify the docloader import
  2. Or remove browser_base from node config to fall back to the standard fetch path
  3. Reinstall/refresh dependencies: uv sync or pip install -U scrapegraphai[browserbase] if the extra exists

Example fix

# shell: before -> raises
pip install browserbase
# after: config unchanged
node_config = {'browser_base': {'api_key': '...', 'session_id': '...'}}
Defensive patterns

Strategy: validation

Validate before calling

def browserbase_available() -> bool:
    try:
        from scrapegraphai.docloaders.browser_base import browser_base_fetch  # noqa
        return True
    except ImportError:
        return False

Try / catch

try:
    graph.run()
except ImportError as e:
    if 'browserbase' in str(e):
        subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'browserbase'])
    else:
        raise

Prevention

When it happens

Trigger: Configuring FetchNodeLevelK (deeplevel graph) with browser_base while the browserbase package/deps are missing.

Common situations: Running DeepScraperGraph/level-k crawls with BrowserBase for the first time in a minimal install; Docker images without optional deps.

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 ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28). Data as JSON: /api/errors/b4912f38bb1772e6. Report an issue: GitHub.