1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
flit-core,
# dependencies
aiohttp,
fsspec,
jinja2,
numpy,
psutil,
pyparsing,
requests,
torch,
tqdm,
xxhash,
# optional-dependencies
# benchmark
matplotlib,
networkx,
pandas,
protobuf,
wandb,
# dev
ipython,
matplotlib-inline,
pre-commit,
torch-geometric,
# full
ase,
graphviz,
h5py,
numba,
opt-einsum,
pynndescent,
rdflib,
rdkit,
scikit-image,
scikit-learn,
scipy,
statsmodels,
sympy,
tabulate,
torchmetrics,
trimesh,
# graphgym
pytorch-lightning,
yacs,
# modelhub
huggingface-hub,
# rag
# pcst-fast,
datasets,
transformers,
sentencepiece,
accelerate,
# test
onnx,
onnxruntime,
pytest,
pytest-cov-stub,
# tests
pytestCheckHook,
writableTmpDirAsHomeHook,
pythonAtLeast,
}:
buildPythonPackage (finalAttrs: {
pname = "torch-geometric";
version = "2.7.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pyg-team";
repo = "pytorch_geometric";
tag = finalAttrs.version;
hash = "sha256-xlOzpoYRoEfIRWSQoZbEPvUW43AMr3rCgIYnxwG/z3A=";
};
build-system = [
flit-core
];
dependencies = [
aiohttp
fsspec
jinja2
numpy
psutil
pyparsing
requests
torch
tqdm
xxhash
];
optional-dependencies = {
benchmark = [
matplotlib
networkx
pandas
protobuf
wandb
];
dev = [
ipython
matplotlib-inline
pre-commit
torch-geometric
];
full = [
ase
# captum
graphviz
h5py
matplotlib
networkx
numba
opt-einsum
pandas
# pgmpy
pynndescent
# pytorch-memlab
rdflib
rdkit
scikit-image
scikit-learn
scipy
statsmodels
sympy
tabulate
torch-geometric
torchmetrics
trimesh
];
graphgym = [
protobuf
pytorch-lightning
yacs
];
modelhub = [
huggingface-hub
];
rag = [
# pcst-fast (unpackaged)
datasets
transformers
pandas
sentencepiece
accelerate
torchmetrics
];
test = [
onnx
onnxruntime
# onnxscript (unpackaged)
pytest
pytest-cov-stub
];
};
pythonImportsCheck = [ "torch_geometric" ];
nativeCheckInputs = [
pytestCheckHook
writableTmpDirAsHomeHook
];
pytestFlags = [
# DeprecationWarning: Failing to pass a value to the 'type_params' parameter of
# 'typing._eval_type' is deprecated, as it leads to incorrect behaviour when calling
# typing._eval_type on a stringified annotation that references a PEP 695 type parameter.
# It will be disallowed in Python 3.15.
"-Wignore::DeprecationWarning"
];
disabledTests = [
# RuntimeError: addmm: computation on CPU is not implemented for SparseCsr + SparseCsr @ SparseCsr without MKL.
# PyTorch built with MKL has better support for addmm with sparse CPU tensors.
"test_asap"
"test_graph_unet"
# AttributeError: type object 'Any' has no attribute '_name'
"test_type_repr"
# AttributeError: module 'torch.fx._symbolic_trace' has no attribute 'List'
"test_set_clear_mask"
"test_sequential_to_hetero"
"test_to_fixed_size"
"test_to_hetero_basic"
"test_to_hetero_with_gcn"
"test_to_hetero_with_basic_model"
"test_to_hetero_and_rgcn_equal_output"
"test_graph_level_to_hetero"
"test_hetero_transformer_self_loop_error"
"test_to_hetero_validate"
"test_to_hetero_on_static_graphs"
"test_to_hetero_with_bases"
"test_to_hetero_with_bases_and_rgcn_equal_output"
"test_to_hetero_with_bases_validate"
"test_to_hetero_with_bases_on_static_graphs"
"test_to_hetero_with_bases_save"
# Failed: DID NOT WARN.
"test_to_hetero_validate"
"test_to_hetero_with_bases_validate"
# Failed: DID NOT RAISE
"test_scatter_backward"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# This test uses `torch.jit` which might not be working on darwin:
# RuntimeError: required keyword attribute 'value' has the wrong type
"test_traceable_my_conv_with_self_loops"
# RuntimeError: no response from torch_shm_manager
"test_data_loader"
"test_data_share_memory"
"test_dataloader"
"test_edge_index_dataloader"
"test_heterogeneous_dataloader"
"test_index_dataloader"
"test_multiprocessing"
"test_share_memory"
"test_storage_tensor_methods"
# NotImplementedError: The operator 'aten::logspace.out' is not currently implemented for the MPS device.
"test_positional_encoding"
]
++ lib.optionals (pythonAtLeast "3.13") [
# RuntimeError: Dynamo is not supported on Python 3.13+
"test_compile"
# RuntimeError: Python 3.13+ not yet supported for torch.compile
"test_compile_graph_breaks"
"test_compile_multi_aggr_sage_conv"
"test_compile_hetero_conv_graph_breaks"
# AttributeError: module 'typing' has no attribute 'io'. Did you mean: 'IO'?
"test_packaging"
# RuntimeError: Boolean value of Tensor with more than one value is ambiguous
"test_feature_store"
]
++ lib.optionals (pythonAtLeast "3.14") [
# TypeError: cannot pickle 'sqlite3.Connection' object
"test_dataloader_on_disk_dataset"
# AssertionError: assert False
# assert utils.supports_bipartite_graphs('SAGEConv')
"test_gnn_cheatsheet"
# AttributeError: readonly attribute
"test_fill_config_store"
"test_register"
"test_to_dataclass"
# AttributeError: '...' object has no attribute '__annotations__'
"test_degree_scaler_aggregation"
"test_explain_message"
"test_fused_aggregation"
"test_gcn_conv_with_decomposed_layers"
"test_hetero_dict_linear_jit"
"test_hetero_linear_basic"
"test_jit"
"test_mlp"
"test_multi_agg"
"test_my_commented_conv"
"test_my_conv_jit"
"test_my_conv_jit_save"
"test_my_default_arg_conv"
"test_my_edge_conv_jit"
"test_my_kwargs_conv"
"test_my_multiple_aggr_conv_jit"
"test_pickle"
"test_sequential_jit"
"test_torch_script"
"test_traceable_my_conv_with_self_loops"
"test_tuple_output_jit"
];
disabledTestPaths =
lib.optionals stdenv.hostPlatform.isDarwin [
# MPS (Metal) tests are failing when using `libtorch_cpu`.
# Crashes in `structured_cat_out_mps`
"test/nn/models/test_deep_graph_infomax.py::test_infomax_predefined_model[mps]"
"test/nn/norm/test_instance_norm.py::test_instance_norm[True-mps]"
"test/nn/norm/test_instance_norm.py::test_instance_norm[False-mps]"
"test/nn/norm/test_layer_norm.py::test_layer_norm[graph-True-mps]"
"test/nn/norm/test_layer_norm.py::test_layer_norm[graph-False-mps]"
"test/nn/norm/test_layer_norm.py::test_layer_norm[node-True-mps]"
"test/nn/norm/test_layer_norm.py::test_layer_norm[node-False-mps]"
"test/utils/test_scatter.py::test_group_cat[mps]"
]
++ lib.optionals (pythonAtLeast "3.14") [
# AttributeError: '...' object has no attribute '__annotations__'
"test/nn/aggr/test_aggr_utils.py"
];
meta = {
description = "Graph Neural Network Library for PyTorch";
homepage = "https://github.com/pyg-team/pytorch_geometric";
changelog = "https://github.com/pyg-team/pytorch_geometric/blob/${finalAttrs.src.tag}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
})
|