dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.34k stars 3k forks source link

Cannot imort JumpingKnowledge from dgl.nn #4779

Closed koki-ki closed 1 year ago

koki-ki commented 1 year ago

❓ Questions and Help

I transcribed this repository in order to understand representation learning and graph neural network. I implemented in singularity and the environment I made follows:

Python 3.6.15 dgl 0.6.0 scikit-learn 0.24.1 tqdm 4.56.0 torch 1.7.1+cuda110

However I can't import JumpingKnowledge from dgl.nn line 6 in model.py and I got an error like this:

  File "main.py", line 8, in <module>
    from model import JKNet
  File "/work/koki-ki/GraphNeuralNetwork/JKNet/model.py", line 7, in <module>
    from dgl.nn import GraphConv, JumpingKnowledge
ImportError: cannot import name 'JumpingKnowledge'

Then I checked on Google Colab that dgl==0.6.0 has the function "JumpingKnowledge" by using :

!pip install dgl==0.6.0
dir(dgl.nn)

Finally I couldn't see the function in the list.

How can I import dgl.nn.JumpingKnowledge?

Or I can't import this function today?

mufeili commented 1 year ago

You need to install DGL >= 0.8.0 for JumpingKnowledge.

Also make sure you check dgl.version as sometimes you can have multiple versions of DGL installed.

koki-ki commented 1 year ago

Thanks a lot! I followed the mannual made by dgl so I couldn't believe it was a mistake.