astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.84k stars 469 forks source link

Build backend error during `rye sync` #872

Open chainyo opened 8 months ago

chainyo commented 8 months ago

Steps to Reproduce

I'm trying to install cugraph dependencies with extra sources and I'm getting an error which doesn't look super comprehensive to me.

  1. rye init --lib foo
  2. rye pin 3.9.18
  3. Add the following to your pyproject.toml
[[tool.rye.sources]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu118"
type = "index"

[[tool.rye.sources]]
name = "cugraph-cu12"
url = "https://pypi.nvidia.com"
type = "index"

[project.optional-dependencies]
cpu = ["torch==2.0.1"]
gpu = [
    "cugraph-cu12==24.2.0",
    "torch==2.0.1"
]
  1. rye sync --features gpu

Expected Result

A good synchronization of the environment and the lock files. It works while using traditional pip install with the extra indexes.

Here is the pyproject.toml of the cugraph project. If I understand well they are using a custom build backend with setuptools. It might be a dependency problem?

Actual Result

It's crashing during the generation of the lock file:

rye sync --features gpu
Reusing already existing virtualenv
Generating production lockfile: /home/user/foo/requirements.lock
error: Failed to download and build: cugraph-cu12==24.2.0
  Caused by: Failed to build: cugraph-cu12==24.2.0
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/home/user/.cache/uv/.tmpD0iI7V/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
  File "/home/user/.cache/uv/.tmpD0iI7V/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/home/user/.cache/uv/.tmpD0iI7V/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/home/user/.cache/uv/.tmpD0iI7V/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 90, in <module>
RuntimeError: Bad params
---
error: could not write production lockfile for project

Caused by:
    failed to generate lockfile

Version Info

rye 0.31.0 commit: 0.31.0 (72e239b8f 2024-03-22) platform: linux (x86_64) self-python: cpython@3.12.2 symlink support: true uv enabled: true

Stacktrace

Stack backtrace: 0: anyhow::error::::msg 1: rye::lock::generate_lockfile 2: rye::lock::update_single_project_lockfile 3: rye::sync::sync 4: rye::cli::sync::execute 5: rye::cli::execute 6: std::panicking::try 7: rye::utils::panic::trap_bad_pipe 8: rye::main 9: std::sys_common::backtrace::__rust_begin_short_backtrace 10: std::rt::lang_start::{{closure}} 11: core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13 12: std::panicking::try::do_call at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40 13: std::panicking::try at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19 14: std::panic::catch_unwind at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14 15: std::rt::lang_start_internal::{{closure}} at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48 16: std::panicking::try::do_call at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40 17: std::panicking::try at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19 18: std::panic::catch_unwind at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14 19: std::rt::lang_start_internal at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20 20: main

chainyo commented 8 months ago

Any hints on how to solve this Build backend failed to determine extra requires with build_wheel() error?