Skip to content
Latchkey

Python "Backend ... is not available" Building a Wheel in CI

The PEP 517 front-end (pip or build) tried to load the build-backend named in pyproject.toml and could not import it. The backend module is misspelled, not declared in requires, or not installed in a no-isolation build.

What this error means

A wheel/sdist build fails immediately with "Cannot import build backend" or "Backend object ... is not available", naming the backend string from [build-system] build-backend. Nothing compiles because the front-end cannot even load the backend.

build output
ERROR Backend 'flit_core.buildapi' is not available.
ModuleNotFoundError: No module named 'flit_core'

Common causes

Backend not listed in [build-system] requires

The build-backend points at a module (e.g. flit_core.buildapi, hatchling.build) whose package is not in requires, so an isolated build never installs it.

Typo or wrong backend string

The build-backend value is misspelled or points at a non-existent object path, so the front-end cannot import it.

How to fix it

Declare the backend in requires and fix the string

Make requires include the backend package and ensure build-backend is the correct object path.

pyproject.toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

Install the backend for no-isolation builds

When isolation is disabled, the backend must already be present.

Terminal
pip install flit_core
python -m build --no-isolation

How to prevent it

  • Keep [build-system] requires and build-backend consistent.
  • Copy the backend’s exact build-backend string from its docs.
  • Prefer isolated builds so requires is provisioned automatically.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →