DGL errors with Jupyter Notebook in Sagemaker (FileNotFoundError: Cannot find DGL C++ graphbolt library at [/opt/conda/lib/python3.10/site-packages/dgl/graphb)

0

I am exploring using DGL in a project. I tried to run one of the example in this github notebook:

https://github.com/aws-samples/aws-healthcare-lifescience-ai-ml-sample-notebooks/blob/main/workshops/Molecular-property-prediction/hiv-inhibitor-prediction-dgl/molecule-hiv-inhibitor-prediction-sagemaker.ipynb

But getting errors when importing DGL. See the logs below. Any help in solving this issue is greatly appreciated.

create a jupyterstudio notebook and run the appropriate cells from link above. Since the requirements file has an year old versions I just replaced the the requirements.txt to pick the latest version.

Logs


FileNotFoundError Traceback (most recent call last) Cell In[1], line 7 4 import torch.nn as nn 5 import pandas as pd ----> 7 import dgl 9 from dgllife.model import load_pretrained 10 from dgllife.utils import smiles_to_bigraph, EarlyStopping, Meter, CanonicalAtomFeaturizer, CanonicalBondFeaturizer

File /opt/conda/lib/python3.10/site-packages/dgl/init.py:16 13 from .logging import enable_verbose_logging # usort: skip 14 from .backend import backend_name, load_backend # usort: skip ---> 16 from . import ( 17 container, 18 cuda, 19 dataloading, 20 function, 21 ops, 22 random, 23 sampling, 24 storages, 25 ) 26 from ._ffi.base import version, DGLError 27 from ._ffi.function import ( 28 extract_ext_funcs, 29 get_global_func, 30 list_global_func_names, 31 register_func, 32 )

File /opt/conda/lib/python3.10/site-packages/dgl/dataloading/init.py:13 11 if F.get_preferred_backend() == "pytorch": 12 from .spot_target import * ---> 13 from .dataloader import * 14 from .dist_dataloader import *

File /opt/conda/lib/python3.10/site-packages/dgl/dataloading/dataloader.py:27 25 from ..batch import batch as batch_graphs 26 from ..cuda import GPUCache ---> 27 from ..distributed import DistGraph 28 from ..frame import LazyFeature 29 from ..heterograph import DGLGraph

File /opt/conda/lib/python3.10/site-packages/dgl/distributed/init.py:5 3 from .dist_context import exit_client, initialize 4 from .dist_dataloader import DistDataLoader ----> 5 from .dist_graph import DistGraph, DistGraphServer, edge_split, node_split 6 from .dist_tensor import DistTensor 7 from .graph_partition_book import GraphPartitionBook, PartitionPolicy

File /opt/conda/lib/python3.10/site-packages/dgl/distributed/dist_graph.py:11 7 from collections.abc import MutableMapping 9 import numpy as np ---> 11 from .. import backend as F, graphbolt as gb, heterograph_index 12 from .._ffi.ndarray import empty_shared_mem 13 from ..base import ALL, DGLError, EID, ETYPE, is_all, NID

File /opt/conda/lib/python3.10/site-packages/dgl/graphbolt/init.py:55 51 except Exception: # pylint: disable=W0703 52 raise ImportError("Cannot load Graphbolt C++ library") ---> 55 load_graphbolt()

File /opt/conda/lib/python3.10/site-packages/dgl/graphbolt/init.py:45, in load_graphbolt() 43 path = os.path.join(dirname, "graphbolt", basename) 44 if not os.path.exists(path): ---> 45 raise FileNotFoundError( 46 f"Cannot find DGL C++ graphbolt library at {path}" 47 ) 49 try: 50 torch.classes.load_library(path)

FileNotFoundError: Cannot find DGL C++ graphbolt library at [/opt/conda/lib/python3.10/site-packages/dgl/graphb

manoj
asked a month ago587 views
2 Answers
0

Hi,

It seems that you are not alone with this problem: https://discuss.dgl.ai/t/filenotfounderror-cannot-find-dgl-c-graphbolt-library/4302/2

You may want to follow this stream on dgl.ai to see if a solution emerges: they currently suggest an upgrade to DGL 2.1.0

Best,

Didier

profile pictureAWS
EXPERT
answered a month ago
  • Thanks Didier. I am aware of this post. I am using DGL 2.1 and still getting the same error. Initially I saw the issue with code so decided to try one of the examples from Sagemaker's github repo but still no luck.

0

I ended up trying Sagemaker Studio classic as I saw a post about Sagemaker Studio not having all the support. It turns out DGL works with Sagemaker Studio classic so looks like an issue with Sagemaker Studio where some libraries may not have been packaged. Can someone confirm if indeed that is the case and there are plan to bring it at par with Studio classic.

manoj
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions