Unable to Build DGL from Source with CUDA 12.2 and PyTorch 2.1

Issue Description:
I am attempting to build DGL (Deep Graph Library) from source in an environment that includes CUDA 12.2 and PyTorch 2.1. Despite the announcement stating the next release would be in November 2023, there is no official release available yet. To proceed, I followed the instructions provided in the DGL installation guide here.

While executing the build script as instructed (bash script/build_dgl.sh -c), I encountered the following error:

$ bash script/build_dgl.sh -c                  
ERROR: Please make sure the environment variable DGL_HOME is set correctly.


  • CUDA Version: 12.2
  • PyTorch Version: 2.1

Have you created the conda env like this bash script/create_dev_conda_env.sh -f -g 12.1 -n dgl-dev-gpu-dgl-3 -p 3.8 -s -t 2.1.0? This works on latest master. Or you could define DGL_HOME as the root directory of DGL repo manually.

One more thing, PyTorch 2.1.0 + cu12.1 is available in latest DGL nightly build(based on master branch) though stable release is not read yet. You could try it via pip3 install --pre dgl -f https://data.dgl.ai/wheels-test/cu121/repo.html.

1 Like

Thanks, it works perfectly!