snap-stanford / GraphGym

Platform for designing and evaluating Graph Neural Networks (GNN)
Other
1.69k stars 185 forks source link

Testing a single experiment: tried to access nonexistent attribute or method. #43

Open florianscheidl opened 2 years ago

florianscheidl commented 2 years ago

-- EDIT --

Hi, I experienced an issue when following your instructions and testing the installation. I'm using Ubuntu 20.04 and installed the CPU version of Pytorch.

When testing the single experiment (bash run_single_cpu.sh), I got the following error:

Traceback (most recent call last):
  File "main.py", line 5, in <module>
    from torch_geometric import seed_everything
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch_geometric/__init__.py", line 4, in <module>
    import torch_geometric.data
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch_geometric/data/__init__.py", line 1, in <module>
    from .data import Data
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch_geometric/data/data.py", line 9, in <module>
    from torch_sparse import SparseTensor
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch_sparse/__init__.py", line 41, in <module>
    from .tensor import SparseTensor  # noqa
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch_sparse/tensor.py", line 13, in <module>
    class SparseTensor(object):
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch/jit/_script.py", line 974, in script
    _compile_and_register_class(obj, _rcb, qualified_name)
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch/jit/_script.py", line 67, in _compile_and_register_class
    torch._C._jit_script_class_compile(qualified_name, ast, defaults, rcb)
RuntimeError: 
Tried to access nonexistent attribute or method 'crow_indices' of type 'Tensor'.:
  File "/home/flo/miniconda3/envs/graphgym/lib/python3.7/site-packages/torch_sparse/tensor.py", line 109
    def from_torch_sparse_csr_tensor(self, mat: torch.Tensor,
                                     has_value: bool = True):
        rowptr = mat.crow_indices()
                 ~~~~~~~~~~~~~~~~ <--- HERE
        col = mat.col_indices()

I found a seemingly closely related problem, see this post: https://github.com/rusty1s/pytorch_sparse/issues/207 and tried to resolve it by downgrading to an older torch-sparse version:

pip install torch-sparse==0.6.12

This seemed to fix the issue.