cocoindex-io/cocoindex · error · ImportError
aiohttp is required for Doris connector. Install it with: pi
Error message
aiohttp is required for Doris connector. Install it with: pip install aiohttp
What it means
Raised by the Doris connector's lazy _get_aiohttp helper when aiohttp is not installed. aiohttp is required for Doris Stream Load (HTTP data ingestion); the connector defers the import and raises an actionable ImportError naming the pip package.
Source
Thrown at python/cocoindex/connectors/doris/_target.py:96
_RowFingerprint = bytes
ValueEncoder = Callable[[Any], Any]
RowT = TypeVar("RowT", default=dict[str, Any])
T = TypeVar("T")
# ============================================================
# Lazy imports
# ============================================================
def _get_aiohttp() -> Any:
"""Lazily import aiohttp."""
try:
import aiohttp # type: ignore[import-not-found]
return aiohttp
except ImportError:
raise ImportError(
"aiohttp is required for Doris connector. "
"Install it with: pip install aiohttp"
)
def _get_pymysql() -> Any:
"""Lazily import pymysql (sync MySQL client for DDL)."""
try:
import pymysql # type: ignore[import-not-found]
return pymysql
except ImportError:
raise ImportError(
"pymysql is required for Doris connector DDL operations. "
"Install it with: pip install pymysql"
)
View on GitHub (pinned to e84aa99b32)
Solutions
- Install aiohttp: `pip install aiohttp` (or the matching cocoindex extra).
- Verify `python -c "import aiohttp"` works.
- Add aiohttp to your project requirements so all environments include it.
Example fix
// before pip install cocoindex // after pip install aiohttp # or cocoindex[doris] if provided
Defensive patterns
Strategy: fallback
Validate before calling
try:
import aiohttp # noqa
except ImportError:
raise SystemExit("Run: pip install aiohttp") Try / catch
try:
app.update()
except ImportError as e:
if "aiohttp" in str(e):
print("pip install aiohttp") Prevention
- Install aiohttp (or the Doris extra) wherever loads run
- Add an import smoke test to CI
- Keep aiohttp pinned in requirements
When it happens
Trigger: Any Doris data-load operation (_stream_load) — and even retryability checks (_is_retryable_error) — in an environment without aiohttp.
Common situations: Base cocoindex install without the Doris extra; minimal Docker images; dependency pruning tools removing 'unused' aiohttp.
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
- pymysql is required for Doris connector DDL operations. Inst
- google-cloud-bigquery is required to use the BigQuery connec
- Authentication failed: HTTP {status_code}
- Invalid response: {text[:200]}
- result.get("Message", "Unknown error")
AI-assisted analysis of cocoindex-io/cocoindex@e84aa99b32 (2026-09-08).
Data as JSON: /api/errors/eb4363f57c056084.
Report an issue: GitHub.