error
pip
build_error
ai_generated
true
error: legacy-install-failure × Encountered error while trying to install package. ╰─> numpy note: This is an issue with the package mentioned above, not pip.
ID: pip/legacy-install-failure-numpy
88%Fix Rate
84%Confidence
1Evidence
2023-09-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| pip 21.0 | active | — | — | — |
| pip 23.0 | active | — | — | — |
| pip 24.0 | active | — | — | — |
Root Cause
The package (e.g., numpy) requires a legacy build system (setup.py) that fails due to missing build dependencies or compiler issues, often because the package does not provide pre-built wheels for the platform.
generic中文
包(例如 numpy)需要旧版构建系统(setup.py),但由于缺少构建依赖项或编译器问题而失败,通常是因为该包未提供针对该平台的预编译 wheel。
Official Documentation
https://pip.pypa.io/en/stable/topics/legacy-builds/Workarounds
-
90% success Install a pre-built wheel if available: `pip install numpy --only-binary :all:` or use `pip install numpy==1.24.3` (a version with wheels for most platforms).
Install a pre-built wheel if available: `pip install numpy --only-binary :all:` or use `pip install numpy==1.24.3` (a version with wheels for most platforms).
-
85% success Install system build dependencies: on Ubuntu, run `sudo apt-get install python3-dev build-essential`; on macOS, `xcode-select --install`.
Install system build dependencies: on Ubuntu, run `sudo apt-get install python3-dev build-essential`; on macOS, `xcode-select --install`.
-
95% success Use conda as an alternative: `conda install numpy` which provides pre-compiled binaries.
Use conda as an alternative: `conda install numpy` which provides pre-compiled binaries.
中文步骤
如果可用,安装预编译 wheel:`pip install numpy --only-binary :all:` 或使用 `pip install numpy==1.24.3`(该版本为大多数平台提供 wheel)。
安装系统构建依赖:在 Ubuntu 上运行 `sudo apt-get install python3-dev build-essential`;在 macOS 上运行 `xcode-select --install`。
使用 conda 作为替代方案:`conda install numpy` 提供预编译的二进制文件。
Dead Ends
Common approaches that don't work:
-
Reinstall pip and retry, assuming pip itself is broken.
90% fail
The error is from the package's build system, not pip's installation.
-
Use `pip install --no-build-isolation numpy` without fixing the underlying build tools.
70% fail
This may expose more errors but doesn't fix missing compilers or libraries.
-
Install numpy from a different index without verifying the version.
80% fail
The same build failure will occur if no pre-built wheel exists.