scipy install error: metadata-generation-failed, Unknown compiler(s) (tested)
error: metadata-generation-failed with Unknown compiler(s) while installing SciPy means pip found no wheel for your Python and tried to compile SciPy from source. The fix is to let pip pick a version that has a wheel (drop the old pin) or use an older Python for the old version, not to install compilers.
1. Reproduce: an old SciPy pin on a new Python
In a fresh python:3-slim container (Python 3.15.1, no C compiler), run.sh installs a pinned old SciPy, then the same version wheels-only, then unpinned:
python -V
P="pip install --no-cache-dir --disable-pip-version-check --root-user-action=ignore"
echo '$ pip install scipy==1.11.4'
$P scipy==1.11.4 2>&1 | grep -vE "^\s*$" | tail -25
echo
echo '$ pip install --only-binary=:all: scipy==1.11.4'
$P --only-binary=:all: scipy==1.11.4 2>&1 | tail -3
echo
echo '$ pip install scipy'
$P scipy 2>&1 | grep -E "Downloading|Successfully"
python -c "import scipy; print('scipy', scipy.__version__)"
Output (pip's full log is long; these are its lines matching ERROR, error, Running `cc, the result lines and Downloading scipy, with the temp build path shortened to ...):
Python 3.15.1
$ pip install scipy==1.11.4
../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> scipy
$ pip install --only-binary=:all: scipy==1.11.4
ERROR: Could not find a version that satisfies the requirement scipy==1.11.4 (from versions: 1.18.1)
ERROR: No matching distribution found for scipy==1.11.4
$ pip install scipy
Downloading scipy-1.18.1-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (62 kB)
Successfully installed numpy-2.5.4 scipy-1.18.1
scipy 1.18.1
- SciPy 1.11.4 has no wheel for Python 3.15, so pip downloaded the source and tried to build it. Meson found no C compiler (
Unknown compiler(s)) and pip reported metadata-generation-failed. --only-binary=:all:turns that into an honest message: the only SciPy wheel for this Python is 1.18.1.- Unpinned
pip install scipypicked the cp315 wheel and installed in seconds.
2. Installing a compiler is not enough
apt-get update -qq >/dev/null 2>&1 && apt-get install -y -qq gcc g++ >/dev/null 2>&1
echo '$ apt-get install gcc g++ && pip install scipy==1.11.4'
pip install --no-cache-dir --disable-pip-version-check --root-user-action=ignore scipy==1.11.4 2>&1 | grep -E "ERROR|error:|Unknown compiler|Dependency|Run-time dependency|fortran|Fortran" | head -12
Output:
$ apt-get install gcc g++ && pip install scipy==1.11.4
error: subprocess-exited-with-error
../meson.build:1:0: ERROR: Compiler cython cannot compile programs.
error: metadata-generation-failed
With gcc/g++ present the build got past the compiler check and failed on Cython instead: old SciPy sources are not meant to build on a Python released years later, and a full SciPy source build also needs Fortran and BLAS/LAPACK. Building from source is rarely the fix.
3. The fixes
- Drop or loosen the pin (
scipy>=1.11) so pip can pick a version with a wheel for your Python. - Need that exact old version? Use a Python it supports. With uv:
$ uv venv -p 3.11 v311 && uv pip install -p v311/bin/python scipy==1.11.4
Using Python 3.11.17 environment at: v311
+ numpy==1.26.4
+ scipy==1.11.4
3.11.17 scipy 1.11.4
Python 3.11 got the prebuilt scipy 1.11.4 wheel (and a matching numpy 1.26.4) with no compiler. Run pip install --only-binary=:all: scipy==X first: if it says "from versions: ..." you know which versions have wheels for your Python.
Same failure for NumPy: numpy metadata-generation-failed. Also see scipy minimize errors.
Frequently asked questions
Why does pip install scipy fail with metadata-generation-failed?
The pinned SciPy has no wheel for your Python version, so pip tries a source build, which needs C/C++/Fortran compilers and BLAS. Loosen the pin or use a supported Python.
How do I see which scipy versions have wheels for my Python?
Run pip install --only-binary=:all: scipy==X; the error lists the available versions.
Will installing gcc fix the scipy install error?
Usually not: in our test the build then failed on Cython, and SciPy also needs Fortran and BLAS/LAPACK.
Written with AI assistance. Measured on 2026-10-23 in the python:3-slim Docker image (Python 3.15.1, pip with SciPy 1.11.4 / 1.18.1) and with uv-managed Python 3.11.17. Output is pip's real output, filtered with grep as stated. PlainTables is our extension; SciPy is free.