{"record":{"id":"bd3eca9d6ccccab7","repo":"unslothai/unsloth","slug":"pandas-is-required-for-unstructured-seed-processin","errorCode":null,"errorMessage":"pandas is required for unstructured seed processing: {exc}","messagePattern":"pandas is required for unstructured seed processing: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/plugins/data-designer-unstructured-seed/src/data_designer_unstructured_seed/chunking.py","lineNumber":45,"sourceCode":"    return size, overlap\n\n\ndef build_unstructured_preview_rows(\n    *, source_path: Path, preview_size: int, chunk_size: Any, chunk_overlap: Any\n) -> list[dict[str, str]]:\n    parquet_path, rows = materialize_unstructured_seed_dataset(\n        source_path = source_path,\n        chunk_size = chunk_size,\n        chunk_overlap = chunk_overlap,\n    )\n    count = max(0, int(preview_size))\n    if rows:\n        return rows[:count]\n\n    try:\n        import pandas as pd\n    except ImportError as exc:  # pragma: no cover\n        raise RuntimeError(f\"pandas is required for unstructured seed processing: {exc}\") from exc\n\n    dataframe = pd.read_parquet(parquet_path).head(count)\n    return [\n        {\"chunk_text\": str(value.get(\"chunk_text\", \"\")).strip()}\n        for value in dataframe.to_dict(orient = \"records\")\n        if str(value.get(\"chunk_text\", \"\")).strip()\n    ]\n\n\ndef build_multi_file_preview_rows(\n    *,\n    file_entries: list[tuple[Path, str]],\n    preview_size: int,\n    chunk_size: int | None,\n    chunk_overlap: int | None,\n) -> list[dict[str, str]]:\n    cs = _to_int(chunk_size, DEFAULT_CHUNK_SIZE)\n    co = _to_int(chunk_overlap, DEFAULT_CHUNK_OVERLAP)","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/plugins/data-designer-unstructured-seed/src/data_designer_unstructured_seed/chunking.py#L27-L63","documentation":"RuntimeError raised in the preview path of the unstructured seed chunker when pandas cannot be imported. The plugin imports pandas lazily; the fast path (cached parquet already materialized, returning in-memory rows) never needs it, so this error only fires on the first preview of a file when pandas is genuinely missing from the environment. The original ImportError is chained (raise ... from exc) to preserve the root cause.","triggerScenarios":"Calling the preview function on a not-yet-cached source file in a Python environment where pandas (or a pandas dependency like numpy) is not installed or is a broken install.","commonSituations":"Installing the plugin without its optional extras; a venv built from a trimmed requirements list; numpy/pandas ABI mismatch after a partial upgrade producing ImportError at import time.","solutions":["Install pandas into the environment running the backend: pip install pandas.","Reinstall both pandas and numpy together if the chained ImportError mentions a binary incompatibility.","Add pandas to the plugin's dependency extras in deployment manifests."],"exampleFix":"# before\n$ pip install data-designer-unstructured-seed  # no pandas\n\n# after\n$ pip install data-designer-unstructured-seed pandas","handlingStrategy":"validation","validationCode":"def pandas_importable() -> bool:\n    try:\n        import pandas  # noqa: F401\n        return True\n    except ImportError:\n        return False\n\nassert pandas_importable(), \"install pandas before previewing unstructured seeds\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare pandas (and pyarrow) as hard dependencies of the service image.","Smoke-test the preview endpoint right after deployment to catch missing optional deps."],"tags":["pandas","dependency","import-error","plugin"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}