ryderling / DGMS

Code for "Deep Graph Matching and Searching for Semantic Code Retrieval"
24 stars 7 forks source link

关于torch_geometric版本问题 #2

Open bing170215 opened 2 years ago

bing170215 commented 2 years ago

image

ryderling commented 2 years ago

Thanks for your attention. As for this issue, if you want to use our repo directly, please configure the corresponding environment according to the file of environment.yaml in this repo; otherwise, you need to adapt some code in this repo if you want to use the latest version of packages like pytorch_geometric.

skye95git commented 2 years ago

Thanks for your attention. As for this issue, if you want to use our repo directly, please configure the corresponding environment according to the file of environment.yaml in this repo; otherwise, you need to adapt some code in this repo if you want to use the latest version of packages like pytorch_geometric.

Hi, I configure the corresponding environment according to the file of environment.yaml in this repo. I meet some mistakes. When I directly run conda env create -f environment.yaml, there is an error:

Collecting torch-spline-conv==1.1.1
  Downloading https://files.pythonhosted.org/packages/5e/77/5420584cdb1514c580722ca4bc482a509105d64b7c70246e9dc4a3e6d3c5/torch_spline_conv-1.1.1.tar.gz

Pip subprocess error:
    ERROR: Command errored out with exit status 1:
     command: /home/anaconda3/envs/wsz/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k6mu801_/torch-spline-conv/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k6mu801_/torch-spline-conv/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-k6mu801_/torch-spline-conv/pip-egg-info
         cwd: /tmp/pip-install-k6mu801_/torch-spline-conv/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-k6mu801_/torch-spline-conv/setup.py", line 2, in <module>
        import torch
    ModuleNotFoundError: No module named 'torch'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
                                                                                                                                        failed

CondaEnvException: Pip failed

After I change the channels in the environment.yaml, it works. But when I run from torch_geometric.data import DataLoader, there is an error:

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
>>> from torch_geometric.data import DataLoader
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_geometric/__init__.py", line 2, in <module>
    import torch_geometric.nn
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_geometric/nn/__init__.py", line 2, in <module>
    from .data_parallel import DataParallel
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_geometric/nn/data_parallel.py", line 5, in <module>
    from torch_geometric.data import Batch
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_geometric/data/__init__.py", line 1, in <module>
    from .data import Data
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_geometric/data/data.py", line 7, in <module>
    from torch_sparse import coalesce
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_sparse/__init__.py", line 2, in <module>
    from .coalesce import coalesce
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_sparse/coalesce.py", line 2, in <module>
    import torch_scatter
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_scatter/__init__.py", line 3, in <module>
    from .mul import scatter_mul
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_scatter/mul.py", line 3, in <module>
    from torch_scatter.utils.ext import get_func
  File "/home/anaconda3/envs/wsz/lib/python3.6/site-packages/torch_scatter/utils/ext.py", line 5, in <module>
    import torch_scatter.scatter_cuda
ModuleNotFoundError: No module named 'torch_scatter.scatter_cuda'
isHuangXin commented 2 years ago

I know how to fix the dataset loading error --> "The 'data' object was created by an older version of PyG".

You can just downgrade to torch-geometric==1.7.2 to load in the data, no reason to re-install torch-scatter, etc. Looks like @ryderling save pickle files which cannot be loaded within PyG 2.0