How to debug pip-compile errors

Categories:

Problem

When running pip-compile

1pip-compile pyproject.toml

there’s an error with the following message:

Backend subprocess exited when trying to invoke prepare_metadata_for_build_wheel
Failed to parse .../pyproject.toml

And no other info is provided in the console.

Solution

Change runner parameter for ProjectBuilder from quiet_subprocess_runner to default_subprocess_runner to show verbose log:

util.diff
 1--- a/lib/python3.11/site-packages/build/util.py	2023-04-03 18:16:13.713254111 +0500
 2+++ b/lib/python3.11/site-packages/build/util.py	2023-04-03 18:12:29.242171354 +0500
 3@@ -41,9 +41,9 @@
 4                      there.
 5     """
 6     builder = build.ProjectBuilder(
 7         os.fspath(srcdir),
 8-        runner=pyproject_hooks.quiet_subprocess_runner,
 9+        runner=pyproject_hooks.default_subprocess_runner,
10     )
11 
12     if not isolated:
13         return _project_wheel_metadata(builder)