DLG installation issues

Hey,

I am trying to run a script requiring dgl and get the following error messages depending on the torch version:

System specs:
MacOS 13.4
Python 3.9.18
Torch 1.13.1
AttributeError: module ‘dgl.function’ has no attribute ‘copy_src’

System specs:
MacOS 13.4
Python 3.9.18
Torch 1.13.1
FileNotFoundError: Cannot find DGL C++ sparse library at {path}lib/python3.9/site-packages/dgl/dgl_sparse/libdgl_sparse_pytorch_2.1.2.dylib

dlg was installed using: pip install dgl

Thank you for your support,
Best,
Joe

This seems to be caused by the incompatibility between your Torch version and the currently downloaded DGL version. When using pip to download DGL, you can specify a version that is compatible with your environment requirements.

1 Like

@joeloeffler Please refer to the installation guide here: Deep Graph Library

Hello. I am also having this same problem as well:

System specs:
Rocky 9.3
Python 3.9.5
Torch 2.1.2
dgl 2.0a240103+cu121
AttributeError: module ‘dgl.function’ has no attribute ‘copy_src’

Running the example from the documentation also gives the same problem:

https://docs.dgl.ai/en/0.8.x/generated/dgl.function.copy_src.html

Python 3.9.5 (default, Jan 4 2024, 15:23:40)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dgl
>>> message_func = dgl.function.copy_src('h', 'm')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'dgl.function' has no attribute 'copy_src'

@geoffreyweal Hello, please note that the documentation you are viewing belongs to the dgl 0.8 version. However, the dgl you downloaded should be the latest version. This discrepancy may be causing issues during your runtime. I geuss copy_src has been deprecated, and you can use copy_u to address your problem. For more details, you can refer to the documentation here.

1 Like

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