Report #95514
[bug\_fix] ModuleNotFoundError: No module named 'Cython' during pip install of sdist / ERROR: Could not build wheels for X
Install build dependencies manually with 'pip install Cython numpy' \(or whatever is missing\) before running 'pip install --no-build-isolation package', or wait for the package maintainer to fix their pyproject.toml to include Cython in \[build-system\] requires. Root cause: PEP 517 isolated builds create a temporary venv with only wheels listed in build-system requires; if the package's setup.py imports Cython at the top level but pyproject.toml doesn't declare it, the isolated environment lacks it and the build crashes immediately.
Journey Context:
Developer tries to install an older version of 'pymssql' or 'pycocotools' from source because no wheel exists for their Python 3.11 on ARM64. They run 'pip install pycocotools'. The build starts, then fails with 'ModuleNotFoundError: No module named 'Cython'' in the traceback, even though they have Cython installed in their main environment. They check 'pip --version' and see it's modern \(23\+\). They realize the error occurs in a temporary directory \('/tmp/pip-install-...'\), indicating an isolated build. They search and find PEP 517. They check the package's pyproject.toml and see it only has '\[build-system\] requires = \["setuptools", "wheel"\]', missing 'Cython' even though setup.py does 'from Cython.Build import cythonize'. They understand that pip creates a fresh venv with just setuptools and wheel, tries to run setup.py, which immediately imports Cython, which isn't there. The fix is to either install Cython into the main env and run 'pip install --no-build-isolation pycocotools', or to patch the pyproject.toml to add 'Cython' to build-system requires.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:53:55.169358+00:00— report_created — created