{"record":{"id":"c96d8b1d6fa4cb38","repo":"ultralytics/yolov5","slug":"dataset-not-found","errorCode":null,"errorMessage":"Dataset not found ❌","messagePattern":"Dataset not found ❌","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"utils/general.py","lineNumber":393,"sourceCode":"        data[\"path\"] = path  # download scripts\n    for k in \"train\", \"val\", \"test\":\n        if data.get(k):  # prepend path\n            if isinstance(data[k], str):\n                x = (path / data[k]).resolve()\n                if not x.exists() and data[k].startswith(\"../\"):\n                    x = (path / data[k][3:]).resolve()\n                data[k] = str(x)\n            else:\n                data[k] = [str((path / x).resolve()) for x in data[k]]\n\n    # Parse yaml\n    _train, val, _test, s = (data.get(x) for x in (\"train\", \"val\", \"test\", \"download\"))\n    if val:\n        val = [Path(x).resolve() for x in (val if isinstance(val, list) else [val])]  # val path\n        if not all(x.exists() for x in val):\n            LOGGER.info(\"\\nDataset not found ⚠️, missing paths %s\" % [str(x) for x in val if not x.exists()])\n            if not s or not autodownload:\n                raise RuntimeError(\"Dataset not found ❌\")\n            t = time.time()\n            if s.startswith(\"http\") and s.endswith(\".zip\"):  # URL\n                download(s, dir=DATASETS_DIR, curl=True)\n                r = None  # success\n            elif s.startswith(\"bash \"):  # bash script\n                LOGGER.info(f\"Running {s} ...\")\n                r = subprocess.run(s, shell=True, check=False).returncode\n            else:  # python script\n                r = exec(s, {\"yaml\": data})  # noqa: S102  # return None\n            dt = f\"({round(time.time() - t, 1)}s)\"\n            s = f\"success ✅ {dt}, saved to {colorstr('bold', DATASETS_DIR)}\" if r in (0, None) else f\"failure {dt} ❌\"\n            LOGGER.info(f\"Dataset download {s}\")\n    check_font(\"Arial.ttf\" if is_ascii(data[\"names\"]) else \"Arial.Unicode.ttf\", progress=True)  # download fonts\n    return data  # dictionary\n\n\ndef check_amp(model):\n    \"\"\"Checks PyTorch AMP functionality for a model, returns True if AMP operates correctly, otherwise False.\"\"\"","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/ultralytics/yolov5/blob/20d1d78a08277e365d57bfa3a2cce752772d9e59/utils/general.py#L375-L411","documentation":"check_dataset in utils/general.py raises RuntimeError('Dataset not found') when the yaml's val path(s) do not exist on disk AND there is no 'download:' entry (or autodownload=False) to fetch them. The preceding log line lists exactly which paths are missing. This is the top-level dataset gate for train.py/val.py; it only autodownloads when download: is an http..zip URL, a 'bash ...' script, or inline python.","triggerScenarios":"data yaml with val: ../coco/val2017.txt that is absent and no download: key; passing autodownload=False programmatically while the dataset is missing; a download: field that is an empty string (falsy) so the guard still trips.","commonSituations":"First-time training runs; yamls for custom datasets created without a download step; CI caches that exclude the datasets dir; users moving DATASETS_DIR without updating yamls.","solutions":["Add a download: URL to the yaml so check_dataset can fetch it (see coco.yaml for the pattern).","Or download/extract the dataset manually and correct the train/val/test paths to the extracted locations.","Rerun with the same command; the missing paths are logged just above the exception."],"exampleFix":"# before (mydata.yaml)\npath: ../datasets/mydata\ntrain: images/train\nval: images/val\n\n# after (mydata.yaml)\npath: ../datasets/mydata\ndownload: https://example.com/mydata.zip\ntrain: images/train\nval: images/val","handlingStrategy":"validation","validationCode":"from pathlib import Path\nimport yaml\n\ndef dataset_ready(data_yaml: str) -> bool:\n    p = Path(data_yaml).resolve()\n    d = yaml.safe_load(p.read_text())\n    base = Path(d.get('path') or p.parent)\n    val = d.get('val')\n    if not val:\n        return False\n    vals = val if isinstance(val, list) else [val]\n    return all((Path(x) if str(x).startswith('/') else base / x).exists() for x in vals) or bool(d.get('download'))","typeGuard":null,"tryCatchPattern":"try:\n    data = check_dataset(data_yaml)\nexcept RuntimeError as e:\n    if 'Dataset not found' in str(e):\n        raise SystemExit('download the dataset or add a download: URL to the yaml') from e","preventionTips":["Ship a download: URL in every distributed data yaml.","Preflight check_dataset() in CI so missing datasets fail before training starts."],"tags":["dataset","training","download","config"],"backgroundTag":null,"analyzedSha":"20d1d78a08277e365d57bfa3a2cce752772d9e59","analyzedAt":"2026-08-15T02:56:15.443Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}