rohitg00/ai-engineering-from-scratch · error · ImportError

could not build spec for {sibling}

Error message

could not build spec for {sibling}

What it means

Error "could not build spec for {sibling}" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/19-capstone-projects/75-end-to-end-eval-runner/code/main.py:31

import json
import os
import random
import sys
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from dataclasses import dataclass, field
from typing import Callable, Sequence


def _load_sibling(lesson_dir: str, module_name: str = "main"):
    here = os.path.dirname(os.path.abspath(__file__))
    sibling = os.path.normpath(os.path.join(here, "..", "..", lesson_dir, "code", "main.py"))
    if not os.path.isfile(sibling):
        raise ImportError(f"sibling module not found: {sibling}")
    mod_name = f"_sibling_{lesson_dir.replace('-', '_')}"
    spec = importlib.util.spec_from_file_location(mod_name, sibling)
    if spec is None or spec.loader is None:
        raise ImportError(f"could not build spec for {sibling}")
    module = importlib.util.module_from_spec(spec)
    sys.modules[mod_name] = module
    spec.loader.exec_module(module)
    return module


spec_mod = _load_sibling("70-task-spec-format")
metrics_mod = _load_sibling("71-classical-metrics")
exec_mod = _load_sibling("72-code-exec-metric")
calib_mod = _load_sibling("73-perplexity-calibration")
board_mod = _load_sibling("74-leaderboard-aggregation")


TaskSpec = spec_mod.TaskSpec


@dataclass
class Generation:

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/19-capstone-projects/75-end-to-end-eval-runner/code/main.py:31 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26). Data as JSON: /api/errors/8044695ff6dda638. Report an issue: GitHub.