snap-stanford / ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
https://ogb.stanford.edu
MIT License
1.89k stars 397 forks source link

Bug: root path can not use `~` to indicate home directory #405

Closed hzcheney closed 1 year ago

hzcheney commented 1 year ago

Hi @weihua916 , I have just find a bug when I use ~/public_data as the root directory, it will crashed and raise some errors below:

Downloading http://snap.stanford.edu/ogb/data/nodeproppred/mag.zip
Traceback (most recent call last):
  File "/home/hzcheney/miniconda3/envs/maskgae/lib/python3.8/site-packages/ogb/utils/url.py", line 59, in download_url
    with open(path, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '~/public_data/pyg_data/mag.zip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train_nodeclas.py", line 242, in <module>
    dataset = PygNodePropPredDataset(root=root, name=f'ogbn-{args.dataset}')
  File "/home/hzcheney/miniconda3/envs/maskgae/lib/python3.8/site-packages/ogb/nodeproppred/dataset_pyg.py", line 68, in __init__
    super(PygNodePropPredDataset, self).__init__(self.root, transform, pre_transform)
  File "/home/hzcheney/miniconda3/envs/maskgae/lib/python3.8/site-packages/torch_geometric/data/in_memory_dataset.py", line 56, in __init__
    super().__init__(root, transform, pre_transform, pre_filter)
  File "/home/hzcheney/miniconda3/envs/maskgae/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 84, in __init__
    self._download()
  File "/home/hzcheney/miniconda3/envs/maskgae/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 145, in _download
    self.download()
  File "/home/hzcheney/miniconda3/envs/maskgae/lib/python3.8/site-packages/ogb/nodeproppred/dataset_pyg.py", line 126, in download
    path = download_url(url, self.original_root)
  File "/home/hzcheney/miniconda3/envs/maskgae/lib/python3.8/site-packages/ogb/utils/url.py", line 69, in download_url
    raise RuntimeError('Stopped downloading due to interruption.')
RuntimeError: Stopped downloading due to interruption.

After I change the root directory to /home/hzcheney/public_data, it will work as usual.

weihua916 commented 1 year ago

Hi! What's the output of echo $HOME in your environment?