Registry / ai-ml / dgl
library2.2.1pypypiunverified

An open-source Python library for deep learning on graphs, supporting PyTorch, TensorFlow, and Apache MXNet. Currently at version 2.4.0, with releases every few months. Focuses on graph neural networks (GNNs) and scalable graph computation.

pip install dgl
INSTALL
IMPORT
SIG · DGL
D
dgl
ai-mlpythonv2.2.1
Install
68.2s avg
Import
Disk
5487MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
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
musl
glibc
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])
Debug
Known issues
deprecatedSupport for PyTorch 1.13 and earlier versions is deprecated. DGL 2.1+ requires PyTorch >=2.0.0.
fix
Upgrade PyTorch to 2.1.0 or later (or as recommended by DGL version).
affects: >=2.0.0
gotchanumpy 2.0.0 is not fully compatible with DGL <2.4.0. Pin numpy<2.0.0.
fix
pip install 'numpy<2.0.0'
affects: <2.4.0
breakingIn DGL 2.4, distributed module is not imported by default. Users must import dgl.distributed manually.
fix
import dgl.distributed before using distributed features.
affects: 2.4.0 and later
breakingHeteroItemSet replaces ItemSetDict. ItemSetDict is deprecated and will be removed.
fix
Use HeteroItemSet instead of ItemSetDict.
affects: 2.3.0 and later
deprecatedCUDA 11.6 support dropped in DGL 2.1.0. Supported CUDA: 11.7, 11.8, 12.1.
fix
Upgrade CUDA to 11.7 or later.
affects: >=2.1.0
breakingIn DGL 2.2 GraphBolt, MiniBatch now uses 'seeds' attribute instead of 'seed_nodes' and 'node_pairs'.
fix
Access 'seeds' attribute on MiniBatch objects.
affects: 2.2.0 and later
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).
Agent activity
21 hits · last 30 days
node
16
OpenAI (training)
1
Resources