{
  "id": "python/setup-py-install-requires-not-found",
  "signature": "ModuleNotFoundError: No module named 'setuptools._distutils.command.build_ext'",
  "signature_zh": "ModuleNotFoundError：没有名为 'setuptools._distutils.command.build_ext' 的模块",
  "regex": "ModuleNotFoundError:\\ No\\ module\\ named\\ 'setuptools\\._distutils\\.command\\.build_ext'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "A partially-installed or downgraded setuptools leaves the vendored _distutils submodule missing, often after a failed upgrade or a conflicting distutils import.",
  "root_cause_type": "generic",
  "root_cause_zh": "部分安装或降级后的 setuptools 缺少内置的 _distutils 子模块，通常发生在升级失败或 distutils 导入冲突之后。",
  "versions": [
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "No such package on PyPI; pip returns 'No matching distribution found'.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "--no-deps can leave an inconsistent setuptools install if any dependency was previously removed.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "pip uninstall -y setuptools\npip install --no-cache-dir 'setuptools>=68'\npython -c \"from setuptools._distutils.command.build_ext import build_ext; print('ok')\"",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "python -m venv .venv && source .venv/bin/activate\npip install --upgrade pip setuptools wheel\npip install .",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}