{
  "id": "python/pip-legacy-editable-develop-error",
  "signature": "ERROR: File \"setup.py\", line 1, in <module>\n    from setuptools import setup\nModuleNotFoundError: No module named 'setuptools'",
  "signature_zh": "错误：文件 \"setup.py\"，第 1 行\n    from setuptools import setup\nModuleNotFoundError：没有名为 'setuptools' 的模块",
  "regex": "ERROR:\\ File\\ \"setup\\.py\",\\ line\\ 1,\\ in\\ <module>\\\n\\ \\ \\ \\ from\\ setuptools\\ import\\ setup\\\nModuleNotFoundError:\\ No\\ module\\ named\\ 'setuptools'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "The build environment (often an isolated PEP 517 env or a fresh venv) does not have setuptools installed, and the project's setup.py imports it unconditionally.",
  "root_cause_type": "generic",
  "root_cause_zh": "构建环境（通常是隔离的 PEP 517 环境或全新的 venv）未安装 setuptools，而项目的 setup.py 无条件导入它。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "setup.py must be evaluated before install_requires is processed, so the import fails first.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "pip build isolation creates a fresh env for the build, so the host setuptools is not visible.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the project still needs setup.py for dynamic metadata, removing it breaks the build entirely.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Add a build-system table to pyproject.toml: [build-system]\\nrequires = [\"setuptools>=61\", \"wheel\"]\\nbuild-backend = \"setuptools.build_meta\"",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Install with build isolation disabled: pip install --no-build-isolation .",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Install setuptools in the active venv then run pip install -e . --no-build-isolation",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}