error: legacy-install-failure × Encountered error while trying to install package. ╰─> numpy note: This is an issue with the package mentioned above, not pip. hint: See the output of 'pip debug --verbose' for an overview of the current compatibility.
ID: pip/legacy-setup-py-install-error
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| pip 21.3+ | active | — | — | — |
| numpy <1.20 | active | — | — | — |
| Python 3.10 | active | — | — | — |
Root Cause
Pip's legacy setup.py install path failed because the package (e.g., numpy) uses an outdated build system that is incompatible with the current pip or Python version, often due to missing compiler toolchain or unsupported build flags.
generic中文
Pip 的传统 setup.py 安装路径失败,因为包(例如 numpy)使用了与当前 pip 或 Python 版本不兼容的过时构建系统,通常是由于缺少编译器工具链或不支持的构建标志。
Official Documentation
https://pip.pypa.io/en/stable/topics/backtracking/Workarounds
-
85% success Upgrade the package to a version that supports modern build backends: pip install numpy>=1.20
Upgrade the package to a version that supports modern build backends: pip install numpy>=1.20
-
90% success Use a pre-built wheel if available: pip install --only-binary=:all: numpy
Use a pre-built wheel if available: pip install --only-binary=:all: numpy
-
75% success Install a compatible Python version that still supports the legacy setup.py (e.g., Python 3.8) and use pip<21.0
Install a compatible Python version that still supports the legacy setup.py (e.g., Python 3.8) and use pip<21.0
中文步骤
将包升级到支持现代构建后端的版本:pip install numpy>=1.20
如果可用,使用预构建的 wheel:pip install --only-binary=:all: numpy
安装仍支持传统 setup.py 的兼容 Python 版本(例如 Python 3.8)并使用 pip<21.0
Dead Ends
Common approaches that don't work:
-
Reinstalling pip with --upgrade pip
20% fail
Upgrading pip alone does not fix the underlying build system incompatibility; the issue is with the package's setup.py, not pip itself.
-
Manually running python setup.py install in the package directory
50% fail
This bypasses pip but still uses the same broken build system, leading to the same error or different cryptic failures.
-
Installing with --no-build-isolation flag
40% fail
This may expose missing system dependencies but does not fix the core setup.py issue; often results in different build errors.