Skip to content

uv add torch_cluster fails due to undeclared dependency on torch #251

@danjjackson

Description

@danjjackson

First of all, thanks for all your work on this package, it's invaluable to me.

I switched to using uv as my package/environment manager, but I can't install torch_cluster as I get the following error:

uv add torch torch_geometric torch_cluster
Resolved 47 packages in 98ms
  × Failed to download and build `torch-cluster==1.6.3`
  ├─▶ Build backend failed to determine requirements with `build_wheel()` (exit status: 1)

  │   [stderr]
  │   Traceback (most recent call last):
  │     File "<string>", line 14, in <module>
  │       requires = get_requires_for_build({})
  │     File "/Users/danieljackson/.cache/uv/builds-v0/.tmptMClM2/lib/python3.13/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
  │       return self._get_build_requires(config_settings, requirements=[])
  │              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  │     File "/Users/danieljackson/.cache/uv/builds-v0/.tmptMClM2/lib/python3.13/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
  │       self.run_setup()
  │       ~~~~~~~~~~~~~~^^
  │     File "/Users/danieljackson/.cache/uv/builds-v0/.tmptMClM2/lib/python3.13/site-packages/setuptools/build_meta.py", line 512, in run_setup
  │       super().run_setup(setup_script=setup_script)
  │       ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  │     File "/Users/danieljackson/.cache/uv/builds-v0/.tmptMClM2/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
  │       exec(code, locals())
  │       ~~~~^^^^^^^^^^^^^^^^
  │     File "<string>", line 8, in <module>
  │       from setuptools.build_meta import __legacy__ as backend
  │       ^^^^^^^^^^^^
  │   ModuleNotFoundError: No module named 'torch'

  ╰─▶ This error likely indicates that [email protected] depends on torch, but doesn't declare it as a build dependency. If torch-cluster is a first-party package, consider adding torch to its `build-system.requires`. Otherwise, `uv pip install torch` into the environment and re-run with `--no-build-isolation`.

I'm not sure if this is a uv issue or a torch_cluster issue, but I'd be grateful if someone could take a look.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions