{"id":"47a343b1a614ea51","repo":"pypa/pip","slug":"none-metadata-name-metadata-found-for-distributi-47a343","errorCode":null,"errorMessage":"None {metadata_name} metadata found for distribution: {dist}","messagePattern":"None (.+?) metadata found for distribution: (.+?)","errorType":"exception","errorClass":"NoneMetadataError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/resolution/legacy/resolver.py","lineNumber":80,"sourceCode":"    \"\"\"\n    Check whether the given Python version is compatible with a distribution's\n    \"Requires-Python\" value.\n\n    :param version_info: A 3-tuple of ints representing the Python\n        major-minor-micro version to check.\n    :param ignore_requires_python: Whether to ignore the \"Requires-Python\"\n        value if the given Python version isn't compatible.\n\n    :raises UnsupportedPythonVersion: When the given Python version isn't\n        compatible.\n    \"\"\"\n    # This idiosyncratically converts the SpecifierSet to str and let\n    # check_requires_python then parse it again into SpecifierSet. But this\n    # is the legacy resolver so I'm just not going to bother refactoring.\n    try:\n        requires_python = str(dist.requires_python)\n    except FileNotFoundError as e:\n        raise NoneMetadataError(dist, str(e))\n    try:\n        is_compatible = check_requires_python(\n            requires_python,\n            version_info=version_info,\n        )\n    except specifiers.InvalidSpecifier as exc:\n        logger.warning(\n            \"Package %r has an invalid Requires-Python: %s\", dist.raw_name, exc\n        )\n        return\n\n    if is_compatible:\n        return\n\n    version = \".\".join(map(str, version_info))\n    if ignore_requires_python:\n        logger.debug(\n            \"Ignoring failed Requires-Python check for package %r: %s not in %r\",","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/resolution/legacy/resolver.py#L62-L98","documentation":"NoneMetadataError raised by _check_requires_python in the legacy resolver when reading the distribution's metadata raises FileNotFoundError — i.e. there is no METADATA/PKG-INFO file at all for the distribution. Without metadata pip cannot read Requires-Python (or anything else), so it cannot decide compatibility and surfaces the underlying file error.","triggerScenarios":"Legacy resolver ('--use-feature=no use of new resolver' off, or '--legacy-resolver') processing a distribution whose .dist-info/METADATA is missing from the index/cache, or whose extracted source has no metadata file. dist.requires_python access triggers FileNotFoundError.","commonSituations":"Corrupted pip cache; partially-downloaded distribution; a malformed package on an index; filesystem issue removing the metadata file; an old sdist that fails to generate metadata.","solutions":["Clear the pip cache: 'pip cache purge' (and remove ~/.cache/pip or the build dir).","Upgrade to the new resolver if possible (drop '--use-legacy-resolver') so the failure surfaces more cleanly.","Re-download or rebuild the offending distribution; verify its .dist-info contains METADATA.","If the package on the index is broken, pin a known-good version with 'pkg==X.Y.Z'."],"exampleFix":"# before\npip install --use-legacy-resolver broken-pkg   # NoneMetadataError\n\n# after\npip cache purge\npip install broken-pkg   # new resolver; or pin a known-good version","handlingStrategy":"validation","validationCode":"def distribution_has_metadata(dist) -> bool:\n    try:\n        _ = dist.requires_python\n        return True\n    except FileNotFoundError:\n        return False","typeGuard":"def has_metadata_file(dist_info_dir: str) -> bool:\n    import os\n    return os.path.isfile(os.path.join(dist_info_dir, 'METADATA'))","tryCatchPattern":"from pip._internal.exceptions import NoneMetadataError\ntry:\n    run_pip(['install', '--use-legacy-resolver', 'pkg'])\nexcept NoneMetadataError:\n    run_pip(['cache', 'purge'])\n    run_pip(['install', 'pkg'])   # or pin a known-good version","preventionTips":["Migrate off the legacy resolver when possible.","Clear the pip cache on intermittent metadata errors.","Pin packages to versions known to ship valid metadata."],"tags":["metadata","legacy-resolver","cache","filesystem"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}