Report #40656
[bug\_fix] pip install fails with 'Could not build wheels for ... which use PEP 517 and cannot be installed directly' or 'No module named setuptools' during build
Ensure build dependencies are available: 'pip install --upgrade pip setuptools wheel'. If building packages with C extensions, install the system C compiler \(build-essential on Ubuntu, Xcode on macOS, MSVC on Windows\) or use pre-built wheels with '--only-binary :all:'.
Journey Context:
You try to pip install a new package \(e.g., psutil or Pillow\) in a fresh virtual environment. It fails with 'Could not build wheels' and mentions PEP 517. Checking the logs, you see 'error: Microsoft Visual C\+\+ 14.0 is required' on Windows, or 'gcc: error' on Linux, or 'No module named setuptools' despite having pip. You realize that modern pip uses isolated build environments \(PEP 517/518\) that don't inherit your installed setuptools/wheel unless they're declared as build-system requires, or the package needs compilation tools. Upgrading pip, setuptools, and wheel ensures the build frontend has the latest machinery. For missing compilers, installing the platform-specific build tools allows the C extension compilation to succeed. Alternatively, forcing binary wheels avoids compilation entirely if the package provides them.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:42:52.988647+00:00— report_created — created