Skip to content

Custom backend-path not working in uv build command #19771

@markuspi

Description

@markuspi

Summary

Running uv build with a custom [build-system].backend-path in pyproject.toml results in a ModuleNotFoundError. It appears that in one step of the isolated build, the referenced directory is not copied to the temporary build directory

Running uv pip install . runs without problems though.

[build-system]
requires = [
  # ...
]
build-backend = "my_backend:builder"
backend-path = ["backend_dir"]

PoC

A minimal poc is available at https://github.com/markuspi/uv_backend_path_poc

  • Checkout PoC and cd into repo root

  • Run uv build --no-cache --verbose

  • Observe error:

    full_error.txt

    Traceback (most recent call last):
      File "<string>", line 8, in <module>
        from my_backend import builder as backend
    ModuleNotFoundError: No module named 'my_backend'
      × Failed to build `D:\dev\repos\poc_backend_path`
      ├─▶ The build backend returned an error
      ╰─▶ Call to `my_backend:builder.build_wheel` failed (exit code: 1)
    
    hint: This error likely indicates that `poc-backend-path@0.1.0` depends on `my_backend`, but doesn't declare it as a build dependency. If `poc-backend-path` is a first-party package, consider adding `my_backend` to its `build-system.requires`. Otherwise, either add it to your `pyproject.toml` under:
    
    [tool.uv.extra-build-dependencies]
    poc-backend-path = ["my_backend"]
    
    or `uv pip install my_backend` into the environment and re-run with `--no-build-isolation`.
  • Running uv pip install works without problem

    uv venv venv2
    uv pip install --no-cache -p venv2 .
    

Platform

Windows 11 x86_64

Version

uv 0.11.19 (7b2cff1 2026-06-03 x86_64-pc-windows-msvc)

Python version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions