DGL 2.1.0 wont work on Sagemaker Notebook

Hi there. I’ve been trying to work on the newer version of dgl using AWS Sagemaker. But when I load the library with import dgl I always get the following error:

DGL backend not selected or invalid.  Assuming PyTorch for now.
Setting the default backend to "pytorch". You can change it in the ~/.dgl/config.json file or export the DGLBACKEND environment variable.  Valid options are: pytorch, mxnet, tensorflow (all lowercase)
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[1], line 1
----> 1 import dgl

File ~/SageMaker/aworld_recommender/myenv/lib/python3.10/site-packages/dgl/__init__.py:14
     12 # Backend and logging should be imported before other modules.
     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,
   (...)
     24     storages,
     25 )
     26 from ._ffi.base import __version__, DGLError

File ~/SageMaker/aworld_recommender/myenv/lib/python3.10/site-packages/dgl/backend/__init__.py:122
    118         set_default_backend(default_dir, "pytorch")
    119         return "pytorch"
--> 122 load_backend(get_preferred_backend())
    125 def is_enabled(api):
    126     """Return true if the api is enabled by the current backend.
    127 
    128     Parameters
   (...)
    136         True if the API is enabled by the current backend.
    137     """

File ~/SageMaker/aworld_recommender/myenv/lib/python3.10/site-packages/dgl/backend/__init__.py:51, in load_backend(mod_name)
     48 else:
     49     raise NotImplementedError("Unsupported backend: %s" % mod_name)
---> 51 from .._ffi.base import load_tensor_adapter  # imports DGL C library
     53 version = mod.__version__
     54 load_tensor_adapter(mod_name, version)

File ~/SageMaker/aworld_recommender/myenv/lib/python3.10/site-packages/dgl/_ffi/base.py:50
     48 __version__ = libinfo.__version__
     49 # library instance of nnvm
---> 50 _LIB, _LIB_NAME, _DIR_NAME = _load_lib()
     52 # The FFI mode of DGL
     53 _FFI_MODE = os.environ.get("DGL_FFI", "auto")

File ~/SageMaker/aworld_recommender/myenv/lib/python3.10/site-packages/dgl/_ffi/base.py:39, in _load_lib()
     37 """Load libary by searching possible path."""
     38 lib_path = libinfo.find_lib_path()
---> 39 lib = ctypes.CDLL(lib_path[0])
     40 dirname = os.path.dirname(lib_path[0])
     41 basename = os.path.basename(lib_path[0])

File ~/anaconda3/envs/JupyterSystemEnv/lib/python3.10/ctypes/__init__.py:374, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    371 self._FuncPtr = _FuncPtr
    373 if handle is None:
--> 374     self._handle = _dlopen(self._name, mode)
    375 else:
    376     self._handle = handle

OSError: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/ec2-user/SageMaker/aworld_recommender/myenv/lib/python3.10/site-packages/dgl/libdgl.so)

How can I handle it?

I installed dgl 2.1.0 in a pip environment and I created a new kernel out of that env

I have not run into this issue. But it is similar to OSError: /lib64/libm.so.6: version `GLIBC_2.27' not found · Issue #7046 · dmlc/dgl · GitHub

Yes, it is similar but it doesn’t provide any way to resolve the issue. I’m trying to install the libraries in a container since the nvidia one is too big for my application and I don’t need a GPU

Hi, what’s your OS version? I may worth checking if you GLIBC version of your OS is the same. This may happen if you OS is an older version.

I’m not using any OS, I’m using a Sagemaker notebook