Skip to content

Commit a5b69c3

Browse files
authored
Remove deprecated torch-cluster in favor of pyg-lib (#10682)
Part of #10684.
1 parent abbb4b8 commit a5b69c3

44 files changed

Lines changed: 204 additions & 183 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ To develop PyG on your machine, here are some tips:
2323
print(torch.__version__)
2424
```
2525

26-
1. *(Optional)* Follow the [installation instructions](https://github.com/pyg-team/pytorch_geometric#installation) to install `pyg-lib`, `torch-scatter`, `torch-sparse`, and `torch-cluster` (if you haven't already).
26+
1. *(Optional)* Follow the [installation instructions](https://github.com/pyg-team/pytorch_geometric#installation) to install `pyg-lib`, `torch-scatter`, and `torch-sparse` (if you haven't already).
2727
Note that this step is optional and only necessary if you develop a feature that uses one of these libraries.
2828

2929
```bash
30-
pip install pyg-lib torch-scatter torch-sparse torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
30+
pip install pyg-lib torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
3131
```
3232

3333
where `${TORCH}` should be replaced by your PyTorch version (*e.g.*, `2.8.0`), and `${CUDA}` should be replaced by your CUDA version (*e.g.*, `cpu`, `cu126`, `cu128`, or `cu129`).
@@ -68,7 +68,7 @@ To develop PyG on your machine, here are some tips:
6868
pytest
6969
```
7070

71-
In case an error occurs, please first check if all sub-packages ([`pyg-lib`](https://github.com/pyg-team/pyg-lib), [`torch-scatter`](https://github.com/rusty1s/pytorch_scatter), [`torch-sparse`](https://github.com/rusty1s/pytorch_sparse) and [`torch-cluster`](https://github.com/rusty1s/pytorch_cluster)) are on its latest reported version.
71+
In case an error occurs, please first check if all sub-packages ([`pyg-lib`](https://github.com/pyg-team/pyg-lib), [`torch-scatter`](https://github.com/rusty1s/pytorch_scatter), and [`torch-sparse`](https://github.com/rusty1s/pytorch_sparse)) are on its latest reported version.
7272

7373
1. Install pre-commit hooks:
7474

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,5 @@ runs:
102102
UV_INDEX_STRATEGY: unsafe-best-match
103103
run: |
104104
uv pip install scipy
105-
uv pip install --no-index --upgrade torch-scatter torch-sparse torch-cluster -f https://data.pyg.org/whl/torch-${{ inputs.torch-version }}+${{ inputs.cuda-version }}.html
105+
uv pip install --no-index --upgrade torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-${{ inputs.torch-version }}+${{ inputs.cuda-version }}.html
106106
shell: bash

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1515

1616
### Deprecated
1717

18+
- Deprecated support for `torch-cluster` in favor of `pyg-lib>=0.6.0` ([#10682](https://github.com/pyg-team/pytorch_geometric/pull/10682))
1819
- Deprecated support for `torch-spline-conv` in favor of `pyg-lib>=0.6.0` ([#10622](https://github.com/pyg-team/pytorch_geometric/pull/10622))
1920

2021
### Removed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,9 @@ pip install torch_geometric
354354

355355
If you want to utilize the full set of features from PyG, there exists several additional libraries you may want to install:
356356

357-
- **[`pyg-lib`](https://github.com/pyg-team/pyg-lib)**: Heterogeneous GNN operators, graph sampling routines, and [`SplineConv`](https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.nn.conv.SplineConv.html) support
357+
- **[`pyg-lib`](https://github.com/pyg-team/pyg-lib)**: Heterogeneous GNN operators, graph sampling routines, graph clustering routines, and [`SplineConv`](https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.nn.conv.SplineConv.html) support
358358
- **[`torch-scatter`](https://github.com/rusty1s/pytorch_scatter)**: Accelerated and efficient sparse reductions
359359
- **[`torch-sparse`](https://github.com/rusty1s/pytorch_sparse)**: [`SparseTensor`](https://pytorch-geometric.readthedocs.io/en/latest/advanced/sparse_tensor.html) support
360-
- **[`torch-cluster`](https://github.com/rusty1s/pytorch_cluster)**: Graph clustering routines
361360

362361
These packages come with their own CPU and GPU kernel implementations based on the [PyTorch C++/CUDA/hip(ROCm) extension interface](https://github.com/pytorch/extension-cpp).
363362
For a basic usage of PyG, these dependencies are **fully optional**.
@@ -370,7 +369,7 @@ For ease of installation of these extensions, we provide `pip` wheels for all ma
370369
To install the binaries for PyTorch 2.11, simply run
371370

372371
```
373-
pip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.11.0+${CUDA}.html
372+
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.11.0+${CUDA}.html
374373
```
375374

376375
where `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130` depending on your PyTorch installation.
@@ -386,7 +385,7 @@ where `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130`
386385
To install the binaries for PyTorch 2.10, simply run
387386

388387
```
389-
pip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.10.0+${CUDA}.html
388+
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.10.0+${CUDA}.html
390389
```
391390

392391
where `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130` depending on your PyTorch installation.
@@ -402,7 +401,7 @@ where `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130`
402401
To install the binaries for PyTorch 2.9, simply run
403402

404403
```
405-
pip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.9.0+${CUDA}.html
404+
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.9.0+${CUDA}.html
406405
```
407406

408407
where `${CUDA}` should be replaced by either `cpu`, `cu126`, `cu128`, or `cu130` depending on your PyTorch installation.

docker/Dockerfile.xpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ RUN echo "source /opt/intel/oneapi/setvars.sh --force" >> /root/.bashrc
2727

2828
# Install PyG
2929
RUN pip install ninja wheel ogb && pip install git+https://github.com/pyg-team/pyg-lib.git && \
30-
pip install torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.5.0+cpu.html && \
30+
pip install torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.5.0+cpu.html && \
3131
pip install torch_geometric

docs/source/install/installation.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ Additional Libraries
2828

2929
If you want to utilize the full set of features from :pyg:`PyG`, there exists several additional libraries you may want to install:
3030

31-
* `pyg-lib <https://github.com/pyg-team/pyg-lib>`__: Heterogeneous GNN operators, graph sampling routines, and :class:`~torch_geometric.nn.conv.SplineConv` support
31+
* `pyg-lib <https://github.com/pyg-team/pyg-lib>`__: Heterogeneous GNN operators, graph sampling routines, graph clustering routines, and :class:`~torch_geometric.nn.conv.SplineConv` support
3232
* `torch-scatter <https://github.com/rusty1s/pytorch_scatter>`__: Accelerated and efficient sparse reductions
3333
* `torch-sparse <https://github.com/rusty1s/pytorch_sparse>`__: :class:`SparseTensor` support, see `here <https://pytorch-geometric.readthedocs.io/en/latest/advanced/sparse_tensor.html>`__
34-
* `torch-cluster <https://github.com/rusty1s/pytorch_cluster>`__: Graph clustering routines
3534

3635
.. note::
37-
``torch-spline-conv`` is no longer required as a separate package.
38-
Its functionality has been migrated to ``pyg-lib>=0.6.0``.
36+
``torch-cluster`` and ``torch-spline-conv`` are no longer required as separate packages.
37+
Their functionality has been migrated to ``pyg-lib>=0.6.0``.
3938

4039
These packages come with their own CPU and GPU kernel implementations based on the :pytorch:`null` `PyTorch C++/CUDA/hip(ROCm) extension interface <https://github.com/pytorch/extension-cpp/>`_.
4140
For a basic usage of :pyg:`PyG`, these dependencies are **fully optional**.
@@ -64,7 +63,7 @@ For ease of installation of these extensions, we provide :obj:`pip` wheels for t
6463

6564
.. code-block:: none
6665
67-
pip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
66+
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
6867
6968
where :obj:`${TORCH}` and :obj:`${CUDA}` should be replaced by the specific :pytorch:`PyTorch` and CUDA versions, respectively:
7069

@@ -86,13 +85,13 @@ For ease of installation of these extensions, we provide :obj:`pip` wheels for t
8685

8786
.. code-block:: none
8887
89-
pip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.11.0+cu130.html
88+
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.11.0+cu130.html
9089
9190
For example, for :pytorch:`PyTorch` 2.10.* and CUDA 12.8, type:
9291

9392
.. code-block:: none
9493
95-
pip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.10.0+cu128.html
94+
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.10.0+cu128.html
9695
9796
**Note:** Binaries of older versions are also provided for :pytorch:`PyTorch` 1.4.0, 1.5.0, 1.6.0, 1.7.0/1.7.1, 1.8.0/1.8.1, 1.9.0, 1.10.0/1.10.1/1.10.2, 1.11.0, 1.12.0/1.12.1, 1.13.0/1.13.1, 2.0.0/2.0.1, 2.1.0/2.1.1/2.1.2, 2.2.0/2.2.1/2.2.2, 2.3.0/2.3.1, 2.4.0/2.4.1, 2.5.0/2.5.1, 2.6.0, 2.7.0/2.7.1, and 2.8.0 (following the same procedure).
9897
**For older versions, you need to explicitly specify the latest supported version number** or install via :obj:`pip install --no-index` in order to prevent a manual installation from source.
@@ -163,7 +162,6 @@ In case a specific version is not supported by `our wheels <https://data.pyg.org
163162
pip install --verbose git+https://github.com/pyg-team/pyg-lib.git
164163
pip install --verbose torch_scatter
165164
pip install --verbose torch_sparse
166-
pip install --verbose torch_cluster
167165
168166
In rare cases, CUDA or :python:`Python` path problems can prevent a successful installation.
169167
:obj:`pip` may even signal a successful installation, but execution simply crashes with :obj:`Segmentation fault (core dumped)`.

docs/source/install/quick-start.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
}
131131

132132
else {
133-
$("#command pre").text(`pip install torch_geometric\n\n# Optional dependencies:\npip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/${$("#command").attr("torch")}+${$("#command").attr("cuda")}.html`);
133+
$("#command pre").text(`pip install torch_geometric\n\n# Optional dependencies:\npip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/${$("#command").attr("torch")}+${$("#command").attr("cuda")}.html`);
134134
}
135135
}
136136

examples/datapipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class MeshOpener(IterDataPipe):
5050
def __init__(self, dp: IterDataPipe) -> None:
5151
try:
5252
import meshio # noqa: F401
53-
import torch_cluster # noqa: F401
53+
import pyg_lib # noqa: F401
5454
except ImportError as e:
5555
raise ImportError(
5656
"To run this example, please install required packages:\n"
57-
"pip install meshio torch-cluster") from e
57+
"pip install meshio pyg-lib") from e
5858

5959
super().__init__()
6060
self.dp = dp

examples/mnist_graclus.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
max_pool,
1414
max_pool_x,
1515
)
16-
from torch_geometric.typing import WITH_SPLINE, WITH_TORCH_CLUSTER
16+
from torch_geometric.typing import WITH_PYG_LIB, WITH_SPLINE
1717
from torch_geometric.utils import normalized_cut
1818

19-
if not WITH_TORCH_CLUSTER:
20-
quit("This example requires 'torch-cluster'")
21-
if not WITH_SPLINE:
19+
if not WITH_PYG_LIB or not WITH_SPLINE:
2220
quit("This example requires 'pyg-lib>=0.6.0'")
2321

2422
path = osp.join(osp.dirname(osp.realpath(__file__)), '..', 'data', 'MNIST')

examples/mnist_nn_conv.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
max_pool,
1515
max_pool_x,
1616
)
17-
from torch_geometric.typing import WITH_TORCH_CLUSTER
17+
from torch_geometric.typing import WITH_PYG_LIB
1818
from torch_geometric.utils import normalized_cut
1919

20-
if not WITH_TORCH_CLUSTER:
21-
quit("This example requires 'torch-cluster'")
20+
if not WITH_PYG_LIB:
21+
quit("This example requires 'pyg-lib>=0.6.0'")
2222

2323
path = osp.join(osp.dirname(osp.realpath(__file__)), '..', 'data', 'MNIST')
2424
transform = T.Cartesian(cat=False)

0 commit comments

Comments
 (0)