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