Report #61667
[bug\_fix] ERROR: Could not build wheels for X which use PEP 517 and cannot be installed directly
Install the system development headers and a C compiler \(e.g., 'apt-get install python3-dev gcc' on Debian/Ubuntu\), or if the package's build dependencies are declared incorrectly, install the required build tools into the environment and use '--no-build-isolation'. Root cause: PEP 517 mandates building in an isolated environment that lacks system compilers and headers required to build C extensions, or the build-system requires specified in pyproject.toml are not present.
Journey Context:
You try to install 'psycopg2' in a 'python:3.11-slim' Docker container. You get 'ERROR: Could not build wheels for psycopg2...'. The logs show 'pg\_config executable not found' and 'error: command 'gcc' failed: No such file or directory'. You try 'pip install --upgrade pip setuptools wheel' but it doesn't help because the issue is missing system libraries. You read the psycopg2 docs and see you need 'libpq-dev' and 'gcc'. You run 'apt-get update && apt-get install -y gcc libpq-dev python3-dev' \(python3-dev provides Python.h\). Now pip install works because the build isolation environment \(or the host if using --no-build-isolation\) has the necessary compilers and headers to build the C extension.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:59:54.686481+00:00— report_created — created