question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug in dgl.data.CiteseerGraphDataset

See original GitHub issue

I am trying to use CiteseerGraphDataset and other datasets and it shows the error as below:

Environment

  • DGL Version: 0.7.1
  • PyTorch: 1.10.0+cu113
  • OS: Ubuntu
  • How you installed DGL: pip install --pre dgl-cu111 -f https://data.dgl.ai/wheels-test/repo.html
  • Python version: 3.8

Code

import dgl
from dgl.data import CiteseerGraphDataset

dataset = CiteseerGraphDataset()
g = dataset[0]

Error

Finished data loading and preprocessing.
  NumNodes: 3327
  NumEdges: 9228
  NumFeats: 3703
  NumClasses: 6
  NumTrainingSamples: 120
  NumValidationSamples: 500
  NumTestSamples: 1000

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/tmp/ipykernel_34530/3377010863.py in <module>
----> 1 dataset = CiteseerGraphDataset()
      2 g = dataset[0]
      3 g

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/citation_graph.py in __init__(self, raw_dir, force_reload, verbose, reverse_edge)
    547         name = 'citeseer'
    548 
--> 549         super(CiteseerGraphDataset, self).__init__(name, raw_dir, force_reload, verbose, reverse_edge)
    550 
    551     def __getitem__(self, idx):

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/citation_graph.py in __init__(self, name, raw_dir, force_reload, verbose, reverse_edge)
     66         self._reverse_edge = reverse_edge
     67 
---> 68         super(CitationGraphDataset, self).__init__(name,
     69                                                    url=url,
     70                                                    raw_dir=raw_dir,

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/dgl_dataset.py in __init__(self, name, url, raw_dir, hash_key, force_reload, verbose)
    280     """
    281     def __init__(self, name, url, raw_dir=None, hash_key=(), force_reload=False, verbose=False):
--> 282         super(DGLBuiltinDataset, self).__init__(name,
    283                                                 url=url,
    284                                                 raw_dir=raw_dir,

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/dgl_dataset.py in __init__(self, name, url, raw_dir, save_dir, hash_key, force_reload, verbose)
     91             self._save_dir = save_dir
     92 
---> 93         self._load()
     94 
     95     def download(self):

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/dgl_dataset.py in _load(self)
    177             self._download()
    178             self.process()
--> 179             self.save()
    180             if self.verbose:
    181                 print('Done saving data into cached files.')

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/citation_graph.py in save(self)
    171         info_path = os.path.join(self.save_path,
    172                                  self.save_name + '.pkl')
--> 173         save_graphs(str(graph_path), self._g)
    174         save_info(str(info_path), {'num_classes': self.num_classes})
    175 

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/graph_serialize.py in save_graphs(filename, g_list, labels)
    128     g_sample = g_list[0] if isinstance(g_list, list) else g_list
    129     if type(g_sample) == DGLHeteroGraph:  # Doesn't support DGLHeteroGraph's derived class
--> 130         save_heterographs(filename, g_list, labels)
    131     else:
    132         raise DGLError(

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/heterograph_serialize.py in save_heterographs(filename, g_list, labels)
     26         g_list = [g_list]
     27     assert all([type(g) == DGLHeteroGraph for g in g_list]), "Invalid DGLHeteroGraph in g_list argument"
---> 28     gdata_list = [HeteroGraphData.create(g) for g in g_list]
     29     _CAPI_SaveHeteroGraphData(filename, gdata_list, tensor_dict_to_ndarray_dict(labels))
     30 

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/heterograph_serialize.py in <listcomp>(.0)
     26         g_list = [g_list]
     27     assert all([type(g) == DGLHeteroGraph for g in g_list]), "Invalid DGLHeteroGraph in g_list argument"
---> 28     gdata_list = [HeteroGraphData.create(g) for g in g_list]
     29     _CAPI_SaveHeteroGraphData(filename, gdata_list, tensor_dict_to_ndarray_dict(labels))
     30 

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/heterograph_serialize.py in create(g)
     40             edata_list.append(tensor_dict_to_ndarray_dict(g.edges[etype].data))
     41         for ntype in g.ntypes:
---> 42             ndata_list.append(tensor_dict_to_ndarray_dict(g.nodes[ntype].data))
     43         return _CAPI_MakeHeteroGraphData(g._graph, ndata_list, edata_list, g.ntypes, g.etypes)
     44 

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/data/heterograph_serialize.py in tensor_dict_to_ndarray_dict(tensor_dict)
     15     ndarray_dict = {}
     16     for key, value in tensor_dict.items():
---> 17         ndarray_dict[key] = F.zerocopy_to_dgl_ndarray(value)
     18     return convert_to_strmap(ndarray_dict)
     19 

~/anaconda3/envs/rapids-21.10/lib/python3.8/site-packages/dgl/backend/pytorch/tensor.py in zerocopy_to_dgl_ndarray(data)
    332 
    333 if LooseVersion(th.__version__) >= LooseVersion("1.10.0"):
--> 334     def zerocopy_to_dgl_ndarray(data):
    335         if data.dtype == th.bool:
    336             data = data.byte()

RuntimeError: Bool type is not supported by dlpack

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
VoVAllencommented, Nov 10, 2021

Please try conda install -c dglteam dgl-cuda11.3 if you are using cuda 11.3

1reaction
tmargarycommented, Nov 3, 2021
conda create --name env_temp python==3.9
conda activate env_temp
pip install --pre dgl-cu111 -f https://data.dgl.ai/wheels-test/repo.html
pip install torch==1.10
python

Python 3.9.0 (default, Nov 15 2020, 14:28:56) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import dgl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tigran/anaconda3/envs/env_temp/lib/python3.9/site-packages/dgl/__init__.py", line 13, in <module>
    from .backend import load_backend, backend_name
  File "/home/tigran/anaconda3/envs/env_temp/lib/python3.9/site-packages/dgl/backend/__init__.py", line 107, in <module>
    load_backend(get_preferred_backend())
  File "/home/tigran/anaconda3/envs/env_temp/lib/python3.9/site-packages/dgl/backend/__init__.py", line 41, in load_backend
    from .._ffi.base import load_tensor_adapter # imports DGL C library
  File "/home/tigran/anaconda3/envs/env_temp/lib/python3.9/site-packages/dgl/_ffi/base.py", line 44, in <module>
    _LIB, _LIB_NAME, _DIR_NAME = _load_lib()
  File "/home/tigran/anaconda3/envs/env_temp/lib/python3.9/site-packages/dgl/_ffi/base.py", line 34, in _load_lib
    lib = ctypes.CDLL(lib_path[0])
  File "/home/tigran/anaconda3/envs/env_temp/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory
Read more comments on GitHub >

github_iconTop Results From Across the Web

CiteseerGraphDataset — DGL 0.9.1post1 documentation
CiteseerGraphDataset¶ · raw_dir (str) – Raw file directory to download/contains the input data directory. · force_reload (bool) – Whether to reload the dataset....
Read more >
dgl.data — DGL 0.8.2post1 documentation - DGL Docs
The dgl.data package contains datasets hosted by DGL and also utilities for downloading, processing, saving and loading data from external resources.
Read more >
May 2022 Update Note - Deep Graph Library
A dataset for node classification from dgl.data import BAShapeDataset dataset = BAShapeDataset() num_classes = dataset.num_classes graph ...
Read more >
CoraGraphDataset — DGL 0.9.1post1 documentation
Bases: dgl.data.citation_graph.CitationGraphDataset. Cora citation network dataset. Deprecated since version 0.5.0: graph is deprecated, it is replaced by:.
Read more >
4.3 Process data — DGL 0.8.2post1 documentation - DGL Docs
from dgl.data import DGLDataset class QM7bDataset(DGLDataset): _url ... load data dataset = CiteseerGraphDataset(raw_dir='') graph = dataset[0] # get split ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found