Open kaiqiaohan opened 10 months ago
Thanks for your interests in our project.
I tried this script on multiple machines and there does not seem to be any problem.
If this line is not working on your machine, could you please try to replace this line with
g = dgl.from_scipy(adj)
?
Please lmk if you have any other concern.
@jumxglhf I'm running into the same issue, I created a fresh virtual environment running python 3.10.13
, my install packages are listed below. I install the specified versions of the packages as listed in the README with pip install dgl==0.9.0 torch==1.12.0 ogb==1.3.4
While running the hetero_graph_gen.py
file I'm running into the following error.
❯ python hetero_graph_gen.py
/Users/saurav/dev/SauravMaheshkar/ParetoGNN/venv/lib/python3.10/site-packages/dgl/heterograph.py:72: DGLWarning: Recommend creating graphs by `dgl.graph(data)` instead of `dgl.DGLGraph(data)`.
dgl_warning('Recommend creating graphs by `dgl.graph(data)`'
Traceback (most recent call last):
File "/Users/saurav/dev/SauravMaheshkar/ParetoGNN/hetero_graph_gen.py", line 81, in <module>
g = dgl.DGLGraph(adj)
File "/Users/saurav/dev/SauravMaheshkar/ParetoGNN/venv/lib/python3.10/site-packages/dgl/heterograph.py", line 74, in __init__
(sparse_fmt, arrays), num_src, num_dst = utils.graphdata2tensors(gidx)
File "/Users/saurav/dev/SauravMaheshkar/ParetoGNN/venv/lib/python3.10/site-packages/dgl/utils/data.py", line 201, in graphdata2tensors
raise DGLError('Unsupported graph data type:', type(data))
dgl._ffi.base.DGLError: ('Unsupported graph data type:', <class 'scipy.sparse._csr.csr_array'>)
PS: Using dgl.graph(data)
doesn't help either.
@kaiqiaohan I was able to get it working by using, does this change work for you ?
import scipy.sparse as sp
csr_mat = sp.csr_matrix(adj)
g = dgl.from_scipy(csr_mat)
Could you share more detailed info about dependencies and environments? I met the following error
I think it may be the problem of other unlisted packages' version.