jumxglhf / ParetoGNN

Official repository for ICLR'23 paper: Multi-task Self-supervised Graph Neural Network Enable Stronger Task Generalization
Creative Commons Zero v1.0 Universal
36 stars 1 forks source link

Dependencies and Environments #1

Open kaiqiaohan opened 10 months ago

kaiqiaohan commented 10 months ago

Could you share more detailed info about dependencies and environments? I met the following error

  File "ParetoGNN-main/hetero_graph_gen.py", line 56, in <module>
    g = dgl.DGLGraph(adj)
  File "lib/python3.9/site-packages/dgl/heterograph.py", line 74, in __init__
    (sparse_fmt, arrays), num_src, num_dst = utils.graphdata2tensors(gidx)
  File "lib/python3.9/site-packages/dgl/utils/data.py", line 201, in graphdata2tensors
    dgl._ffi.base.DGLError: ('Unsupported graph data type:', <class 'scipy.sparse._csr.csr_array'>)

I think it may be the problem of other unlisted packages' version.

jumxglhf commented 8 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.

SauravMaheshkar commented 8 months ago

@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

Python Virtual Environment ```bash Package Version ------------------ -------- certifi 2024.2.2 charset-normalizer 3.3.2 dgl 0.9.0 idna 3.6 joblib 1.3.2 littleutils 0.2.2 networkx 3.2.1 numpy 1.26.3 ogb 1.3.4 outdated 0.2.2 pandas 2.2.0 pip 23.0.1 psutil 5.9.8 python-dateutil 2.8.2 pytz 2024.1 requests 2.31.0 scikit-learn 1.4.0 scipy 1.12.0 setuptools 65.5.0 six 1.16.0 threadpoolctl 3.2.0 torch 1.12.0 tqdm 4.66.1 typing_extensions 4.9.0 tzdata 2023.4 urllib3 2.2.0 ```

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.

SauravMaheshkar commented 8 months ago

@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)