1. Error reporting
import dgl
Error reported:
RuntimeError: DGL requires PyTorch >= 1.12.0
The error message prompts that the torch version needs to be upgraded. In other words, the dgl version needs to be lowered.
You can check the local dgl version first.
pip list
2. Solution
dgl 1.1.0 This version corresponds to python39 torch 1.9
and can also correspond to python37 torch 1.10.2
installation method
pip install --user dgl==1.1.0
Or access the mirror
https://pypi.tuna.tsinghua.edu.cn/simple/dgl/
3. Novice’s secret method
Adjust the version number to download dgl, run the local code, delete the dgl if the operation fails, and continue to lower the version number for installation. This cycle continues until the script runs successfully.
pip install --user dgl==1.1.0