Report #17804
[bug\_fix] ERROR: Could not build wheels for X which use PEP 517 and cannot be installed directly
Install the build system requirements \(e.g., \`pip install setuptools wheel\` or the specific backend like \`flit-core\`\) into the host environment and pass \`--no-build-isolation\` to pip, or ensure the environment has network access so pip can install build dependencies in the isolated build environment.
Journey Context:
You are building a Docker image using \`python:3.9-slim\` for a production deployment. Your Dockerfile contains \`RUN pip install -r requirements.txt\`. One dependency, \`fastavro\` \(or a similar package with C extensions\), only provides an sdist \(source distribution\) and no wheel for your platform. Pip attempts to build a wheel using the PEP 517 build isolation feature. It creates a temporary build environment, but because this is a minimal 'slim' image lacking \`gcc\`, \`python3-dev\`, or because \`setuptools\` and \`wheel\` are not present in the isolated environment, the build fails with \`ERROR: Could not build wheels for X which use PEP 517 and cannot be installed directly\` or \`BackendUnavailable\`. You realize that PEP 517 isolation means pip ignores your host installed packages during the build. You fix this by either installing the build dependencies in the host \(\`pip install setuptools wheel cython\`\) and using \`--no-build-isolation\`, or by installing \`build-essential\` and \`python3-dev\` in the Docker image to allow the isolated build to compile the C extensions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:23:35.482643+00:00— report_created — created