Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import issue in ogb #289

Closed
Zahra-Bakhtiari opened this issue Dec 9, 2021 · 15 comments
Closed

Import issue in ogb #289

Zahra-Bakhtiari opened this issue Dec 9, 2021 · 15 comments

Comments

@Zahra-Bakhtiari
Copy link

The ogb package can not be imported on console now and will generate errors for the below imports:

import torch
import ogb
from ogb.graphproppred import GraphPropPredDataset
from ogb.graphproppred import PygGraphPropPredDataset

In addition log generation is not implemented in init files. I also noticed that the lines in init that blocks proper import have not yet been used anywhere else in the program so I have a PR to address these issues.

https://github.com/Zahra-Bakhtiari/GraphPropPred_bug_fix/pull/1/files

I also did some google search and noticed that this is a big struggle for the new ogb users, several open issues exist on it :)

@weihua916
Copy link
Contributor

Hi! Thanks for the PR! Could you elaborate on what is the import error? I think people just need to install some prerequisites (torch, rdkit, torch-geometric, dgl) before using ogb. I try to print fewer errors because some package is not necessary for some users (dgl is not necessary for PyG users, rdkit is not necessary for non-molecule graph datasets)

@Zahra-Bakhtiari
Copy link
Author

Without logs users are getting just below error:
image

@Zahra-Bakhtiari
Copy link
Author

with the changes in this PR import is successful for both:
image

@Zahra-Bakhtiari
Copy link
Author

Zahra-Bakhtiari commented Dec 10, 2021

these 2 lines are causing import issues:

from torch_geometric.data import InMemoryDataset noqa pylint: disable
from ogb.io.read_graph_pyg import read_graph_pyg

it looks like InMemoryDataset is not actively being used anywhere in the file so it can get converted to object.

In addition the below line in init also causes import issue:

TODO: The below line causes import issue for "from ogb.graphproppred import PygGraphPropPredDataset"
and is not being used anywhere else
self.data, self.slices = torch.load(self.processed_paths[0])

@weihua916
Copy link
Contributor

weihua916 commented Dec 10, 2021

Did you install torch-geometric? In order to use PyGGraphPropDataset, you need to have pyg.

@Zahra-Bakhtiari
Copy link
Author

yes, this is the screenshot of my virtualenv:

image

@weihua916
Copy link
Contributor

can you successfully do the following?

from torch_geometric.data import InMemoryDataset

It's likely that your torch_geometric is not installed properly.

@Zahra-Bakhtiari
Copy link
Author

image

@Zahra-Bakhtiari
Copy link
Author

the installation looks fine but the import provides this error:
image

@weihua916
Copy link
Contributor

I see. You need to install torch_sparse correctly. See https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html

@faysalhossain2007
Copy link

faysalhossain2007 commented Apr 20, 2022

Hi I am able to run from torch_geometric.data import InMemoryDataset successfully. But whenever I try to import anything from ogb, the program stuck for infinite time. Import code is: from ogb.graphproppred import Evaluator

I followed the following command to install torch in conda environment:

CUDA=cu113
TORCH=1.11.0
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-geometric

@rusty1s
Copy link
Collaborator

rusty1s commented Apr 21, 2022

Please see my reply in #322 (comment).

@Prasanth-Dwadasi
Copy link

Did you find any solution for this issue? I'm facing the same issue while importing from ogb.graphproppred.
It's taking infinite time to import

@Qitong-Wang
Copy link

Did you find any solution for this issue? I'm facing the same issue while importing from ogb.graphproppred. It's taking infinite time to import

I fix this problem by calling import sklearn at first, sinceogb.graphproppred.evaluate.pycallsfrom sklearn.metrics import ...In my case, it is an issue with sklearn.

@HxyScotthuang
Copy link

Import sklearn before also solve my problem. Thanks! @Qitong-Wang !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants