Install & Compatibility
Where this runs
tested against v2.1.0+cu121 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 91.93s
py 3.11
✕ build_error
✓ 80.83s
py 3.12
✕ build_error
✓ 90.83s
py 3.13
✕ build_error
✓ 9.1s
py 3.9
✕ build_error
✕ timeout
5487MB installed
● package 5487MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
dgl.graph
✓ import dgl
✗ import dgl.graph
dgl.graph is not a direct module; use dgl.graph() function after import dgl.
dgl.nn.SAGEConv
✓ import dgl; from dgl.nn import SAGEConv
✗ from dgl import SAGEConv
SAGEConv is in dgl.nn submodule, not top-level.
dgl.dataloading.DataLoader
✓ from dgl.dataloading import DataLoader
✗ from dgl import DataLoader
DataLoader is in dgl.dataloading submodule.
Basic DGL usage: create graph, assign features, apply SAGEConv layer.
import dgl
import torch
# Create a simple graph with 3 nodes and 2 edges
g = dgl.graph(([0, 1], [1, 2]), num_nodes=3)
# Assign node features
x = torch.randn(3, 5)
# Create a Graph Neural Network layer
from dgl.nn import SAGEConv
conv = SAGEConv(5, 2, 'mean')
# Forward pass
h = conv(g, x)
print(h.shape) # torch.Size([3, 2])
Upgrade
Version history
2.2.1latest on PyPI · released May 13, 2024
Audit
Dependencies
torchrequiredPrimary deep learning backend (>=2.1.0, <2.5). Must be installed separately.
numpyoptionalArray operations; version must be <2.0.0 for DGL <2.4.0, but 2.4.0 may support numpy>=2.0.0.
tensorflowoptionalOptional backend (DGL TF support is legacy, use PyTorch).