python
module_error
ai_generated
true
ModuleNotFoundError: No module named 'setuptools._distutils.command.build_ext'
ID: python/setup-py-install-requires-not-found
80%Fix Rate
86%Confidence
0Evidence
2024-11-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
A partially-installed or downgraded setuptools leaves the vendored _distutils submodule missing, often after a failed upgrade or a conflicting distutils import.
generic中文
部分安装或降级后的 setuptools 缺少内置的 _distutils 子模块,通常发生在升级失败或 distutils 导入冲突之后。
Workarounds
-
95% success
pip uninstall -y setuptools pip install --no-cache-dir 'setuptools>=68' python -c "from setuptools._distutils.command.build_ext import build_ext; print('ok')" -
90% success
python -m venv .venv && source .venv/bin/activate pip install --upgrade pip setuptools wheel pip install .
Dead Ends
Common approaches that don't work:
-
95% fail
No such package on PyPI; pip returns 'No matching distribution found'.
-
70% fail
--no-deps can leave an inconsistent setuptools install if any dependency was previously removed.