dgl._ffi.base.DGLError: DGLGraph.from_networkx is deprecated Error when training

I am running the code some this repository Link. But I am receiving this error dgl._ffi.base.DGLError: DGLGraph.from_networkx is deprecated when I am training. At first I have tried with dgl==0.9.1 and later I tried downgrading to dgl==0.3.1 but still I am facing the problem.

I have changed the code lines from

g_dgl = dgl.DGLGraph(multigraph=True)
g_dgl.from_networkx(g_nx, edge_attrs=['type'])

to

g_dgl = dgl.DGLGraph(multigraph=True).from_networkx(g_nx, edge_attrs=['type'])

as mentioned here. but still I am facing the same issue.

Traceback (most recent call last):
  File "train.py", line 222, in <module>
    main(params)
  File "train.py", line 28, in main
    train = SubgraphDataset(params.db_path, 'train_pos', 'train_neg', params.file_paths,
  File "/home2/harsha.vasamsetti/SumGNN-master/subgraph_extraction/datasets.py", line 100, in __init__
    self.graph = ssp_multigraph_to_dgl(ssp_graph)
  File "/home2/harsha.vasamsetti/SumGNN-master/utils/graph_utils.py", line 77, in ssp_multigraph_to_dgl
    g_dgl = dgl.DGLGraph(multigraph=True).from_networkx(g_nx, edge_attrs=['type'])
  File "/home2/harsha.vasamsetti/.miniconda3/envs/sumgnn_old/lib/python3.8/site-packages/dgl/heterograph.py", line 6076, in from_networkx
    raise DGLError('DGLGraph.from_networkx is deprecated. Please call the following\n\n'
dgl._ffi.base.DGLError: DGLGraph.from_networkx is deprecated. Please call the following

         dgl.from_networkx(nx_graph, node_attrs, edge_attrs)

, which creates a new DGLGraph from the networkx graph.

You can have multiple versions of DGL installed simultaneously. Could you try first uninstalling DGL until you cannot import it and then reinstalling DGL 0.3.1?

@mufeili Thanks for the reply. I have tried DGL=0.4.3 version and it’s working perfectly fine now.

1 Like

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