{
  "id": "pip/egg-info-failure-setup-py-encoding",
  "signature": "error: subprocess-exited-with-error: python setup.py egg_info did not run successfully.\n  exit code: 1\n  __main__.NameError: name 'unicode' is not defined",
  "signature_zh": "错误：子进程以错误退出：python setup.py egg_info 未成功运行。\n  退出代码：1\n  __main__.NameError: 名称 'unicode' 未定义",
  "regex": "error: subprocess-exited-with-error: python setup\\.py egg_info did not run successfully\\.\\n\\s+exit code: 1\\n\\s+__main__\\.NameError: name 'unicode' is not defined",
  "domain": "pip",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Package's setup.py uses Python 2 style 'unicode' built-in, which was removed in Python 3, causing egg_info generation to fail.",
  "root_cause_type": "generic",
  "root_cause_zh": "包的 setup.py 使用了 Python 2 风格的 'unicode' 内置函数，该函数在 Python 3 中被移除，导致 egg_info 生成失败。",
  "versions": [
    {
      "version": "pip 23.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Python 3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "setuptools 58.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Running pip install --no-cache-dir does not fix the root cause; the setup.py is still broken.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Upgrading pip alone does not patch the package's broken setup.py; the NameError persists.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using --use-pep517 may switch to a different build system, but if the package lacks pyproject.toml, it falls back to setup.py and fails again.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Apply monkey-patch in setup.py by adding 'import six' or replacing 'unicode' with 'str' in the package source before installation. Use: pip install --no-build-isolation <package> after patching.",
      "success_rate": 0.75,
      "how": "Apply monkey-patch in setup.py by adding 'import six' or replacing 'unicode' with 'str' in the package source before installation. Use: pip install --no-build-isolation <package> after patching.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Install an older compatible version of the package that supports Python 3: pip install <package>==<last_py3_compatible_version>",
      "success_rate": 0.85,
      "how": "Install an older compatible version of the package that supports Python 3: pip install <package>==<last_py3_compatible_version>",
      "condition": "",
      "sources": []
    },
    {
      "action": "Build the package in a Python 2.7 environment and install the resulting wheel in Python 3. Use: python2 -m pip wheel <package> then pip install <package>.whl",
      "success_rate": 0.7,
      "how": "Build the package in a Python 2.7 environment and install the resulting wheel in Python 3. Use: python2 -m pip wheel <package> then pip install <package>.whl",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 setup.py 中应用猴子补丁，添加 'import six' 或将 'unicode' 替换为 'str'，然后使用 pip install --no-build-isolation <package> 安装。",
    "安装支持 Python 3 的旧版本包：pip install <package>==<last_py3_compatible_version>",
    "在 Python 2.7 环境中构建包并安装生成的 wheel：python2 -m pip wheel <package> 然后 pip install <package>.whl"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pip.pypa.io/en/stable/topics/dependency-resolution/#build-failures",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "partial",
  "first_seen": "2023-05-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}