ImportError: Cannot load Graphbolt C++ library

could you try to uninstall previous DGL before installing the new one?

please share the command you used for installation.

are you working on torch 2.1.0+cpu?

I encountered the same error while running the Python script test3.py :slight_smile:

The error traceback indicates an issue with loading the Graphbolt C++ library:

Traceback (most recent call last):
File “/home/p_gnngw/miniconda3/envs/myenv/lib/python3.8/site-packages/dgl/graphbolt/init.py”, line 50, in load_graphbolt
torch.classes.load_library(path)

ImportError: Cannot load Graphbolt C++ library

I’ve confirmed that I’m using the following versions of DGL, PyTorch, and CUDA:

  • DGL version: 2.1.0.cu121
  • PyTorch version: 2.2.1 + cu121
  • CUDA version: 12.1

Additionally, here are details about my operating system:

LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterprise
Description: Red Hat Enterprise Linux release 8.6 (Ootpa)
Release: 8.6
Codename: Ootpa

And the CUDA version:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Apr__3_17:16:06_PDT_2023
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072_0

I have tried uninstalling and reinstalling both Torch and DGL using the following commands:

conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
conda install -c dglteam/label/cu121 dgl

However, the issue persists. I also attempted to use DGL and PyTorch versions for CUDA 11.8, but encountered the same error."

I’ve corrected the grammar and formatting of the text for clarity. Let me know if you need further assistance

Thanks for your detailed info.

could you try to build DGL from source code on your machine via referring to Install and Setup — DGL 2.1.0 documentation?

OK,thank you so much.

I got the same issue with 2.1.0+cuda12.1 but it work well when i downgrade to the 2.0.0+cuda12.1 version, and i personnaly didn’t notice any issue with the cpu version.

which pytorch version you’re using? and what’s your OS version?

DGL 2.1.0 works well on my side.

(dgl-dev-gpu-dgl-0) ubuntu@ip-xxx:~$ python3 -c "import dgl;import dgl.graphbolt as gb;print(dgl.rand_graph(10,100))"
Graph(num_nodes=10, num_edges=100,
      ndata_schemes={}
      edata_schemes={})
(dgl-dev-gpu-dgl-0) ubuntu@ip-xxx:~$ pip3 list|grep -E 'torch|dgl'
dgl                           2.1.0+cu121
torch                         2.1.0+cu121
torch_geometric               2.5.2
torchdata                     0.7.1
torcheval                     0.0.7
torchmetrics                  1.3.2
(dgl-dev-gpu-dgl-0) ubuntu@ip-xxx:~$ cat /proc/version
Linux version 5.15.0-1041-aws (buildd@lcy02-amd64-120) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #46~20.04.1-Ubuntu SMP Wed Jul 19 15:40:00 UTC 2023
Pytorch version 2.2.1
OS : Ubuntu 22.04

Have tried to install with

pip install  dgl -f https://data.dgl.ai/wheels/cu121/repo.html
pip3 list|grep -E 'torch|dgl'
dgl                          2.1.0+cu121
torch                        2.2.1
torchdata                    0.7.1
torchvision                  0.17.1

the torch is CPU version? If yes, could you try with CPU version of DGL(2.1.0)?

(dgl-dev-gpu-dgl-0) ubuntu@ip-xxx:~$ python3 -c "import dgl;import dgl.graphbolt as gb;print(dgl.rand_graph(10,100))"
Graph(num_nodes=10, num_edges=100,
      ndata_schemes={}
      edata_schemes={})
(dgl-dev-gpu-dgl-0) ubuntu@ip-xxx:~$ pip3 list|grep -E 'torch|dgl'
dgl                           2.1.0+cu121
torch                         2.2.1+cu121
torch_geometric               2.5.2
torchdata                     0.7.1
torcheval                     0.0.7
torchmetrics                  1.3.2
Downloading dgl-2.1.0-cp310-cp310-manylinux1_x86_64.whl (8.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.5/8.5 MB 62.0 MB/s eta 0:00:00
Installing collected packages: dgl
  Attempting uninstall: dgl
    Found existing installation: dgl 2.0.0+cu121
    Uninstalling dgl-2.0.0+cu121:
      Successfully uninstalled dgl-2.0.0+cu121
Successfully installed dgl-2.1.0

And yes the cpu version of dgl-2.1.0 work fine

Hello guys,

Just an update, i have successfully run dgl-2.1.0-cuda.
Before i have the nvidia driver 545 and cuda 12.3 and i just updated to the lastest one ( 550 and cuda 12.4)

And all work fine for me.

2 Likes

Same issue here. I fixed this by downgrading to DGL 2.0.0 for now.

1 Like

Yes, I was working with dgl 2.1.0, I think I was using cuda 11.8. I was also using the container image suggested by DGL (DGL | NVIDIA NGC)

You can try to install from source. That works for me.

1 Like

In the cpu environment even the DGL 2.0.0 didn’t work for me, I was only able to install 1.1.3 without facing any issues during runtime

here’s my environment.yaml for conda

name: yourenvname
channels:
  - conda-forge
dependencies:
  - python=3.10
  - pytorch
  - pytorch_geometric
  - pytorch_scatter
  - pytorch_sparse
  - dgl=1.1.3

Please refer to the install page to install the latest DGL version. As DGL library directly depend on specific torch version, so please make sure DGL and pytorch versions match.

DGL 2.1.0 supports torch 2.0.x, 2.1.x, 2.2.0/1.

Hi Rhett, could you please help with the error? I haven’t been able to solve it for the last 4 hours. Thank you! :blush:

Hi I’m still seeing the same question as OP. Any help is appreciated

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.