ImportError: Cannot load Graphbolt C++ library

Traceback (most recent call last):
File “/root/mypython/fedlearning/FedStar-main/exps/main_multiDS.py”, line 14, in
import setupGC
File “/root/mypython/fedlearning/FedStar-main/lib/setupGC.py”, line 14, in
from utils import get_maxDegree, get_stats, split_data, get_numGraphLabels, init_structure_encoding
File “/root/mypython/fedlearning/FedStar-main/lib/utils.py”, line 6, in
import dgl
File “/root/anaconda3/lib/python3.11/site-packages/dgl/init.py”, line 16, in
from . import (
File “/root/anaconda3/lib/python3.11/site-packages/dgl/dataloading/init.py”, line 13, in
from .dataloader import *
File “/root/anaconda3/lib/python3.11/site-packages/dgl/dataloading/dataloader.py”, line 27, in
from …distributed import DistGraph
File “/root/anaconda3/lib/python3.11/site-packages/dgl/distributed/init.py”, line 5, in
from .dist_graph import DistGraph, DistGraphServer, edge_split, node_split
File “/root/anaconda3/lib/python3.11/site-packages/dgl/distributed/dist_graph.py”, line 11, in
from … import backend as F, graphbolt as gb, heterograph_index
File “/root/anaconda3/lib/python3.11/site-packages/dgl/graphbolt/init.py”, line 55, in
load_graphbolt()
File “/root/anaconda3/lib/python3.11/site-packages/dgl/graphbolt/init.py”, line 52, in load_graphbolt
raise ImportError(“Cannot load Graphbolt C++ library”)
ImportError: Cannot load Graphbolt C++ library
dgl version: dgl-2.1.0.cu121
torch version:2.2.1 + cu121
cuda version: 12.3

dgl version: dgl-2.1.0.cu121 VS cuda version: 12.3 ? Could you try to install cuda 12.1 instead. Or could you try with pure CPU version in a conda environment?

I changed my cuda version to 12.1, but the error message is still the same :smiling_face_with_tear:

could you share the install command you used? what is your OS and version?

I used pip install dgl -f https://data.dgl.ai/wheels/cu121/repo.html
I came across the same problem! my cuda 11.4 torch 12.1 linux

I used pip install dgl and dglgo and I have the same problem. I’m having this problem in a container built using an AWS base image: pytorch-inference:2.1.0-cpu-py310-ubuntu20.04-ec2 to be precise

cuda 11.4? torch 12.1? please share the correct cuda/pytorch version. could you try to uninstall previous DGL before installing the new one?

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