pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.32k stars 3.65k forks source link

ImportError: cannot import name 'set_out_dir' from 'torch_geometric.graphgym.config' #4367

Open angup143 opened 2 years ago

angup143 commented 2 years ago

🐛 Describe the bug

When trying to run the basic graphgym example with "bash run_single.sh ", I get the following error:

  File "main.py", line 9, in <module>
    from torch_geometric.graphgym.config import (
ImportError: cannot import name 'set_out_dir' from 'torch_geometric.graphgym.config' (/opt/conda/lib/python3.7/site-packages/torch_geometric/graphgym/config.py)
Traceback (most recent call last):
  File "main.py", line 9, in <module>
    from torch_geometric.graphgym.config import (
ImportError: cannot import name 'set_out_dir' from 'torch_geometric.graphgym.config' (/opt/conda/lib/python3.7/site-packages/torch_geometric/graphgym/config.py)
Traceback (most recent call last):
  File "main.py", line 9, in <module>
    from torch_geometric.graphgym.config import (
ImportError: cannot import name 'set_out_dir' from 'torch_geometric.graphgym.config' (/opt/conda/lib/python3.7/site-packages/torch_geometric/graphgym/config.py)

I noticed that this might be caused due to a recent change (https://github.com/pyg-team/pytorch_geometric/pull/4338) so I tried updating my pytorch geometric version usingpip install torch-geometric --upgrade but that does not fix the issue.

Environment

rusty1s commented 2 years ago

This seems to be indeed caused by the recent changes in #4338. You would need to install PyG from master for this:

pip install git+https://github.com/pyg-team/pytorch_geometric.git
shahfasal commented 2 years ago

I am facing this issue on Windows 10 CPU environment, have installed PyTorch geometric using above mentioned link by @rusty1s. PyG version: 2.0.4 torch: 1.10.1+cpu

rusty1s commented 2 years ago

Installing PyG master should yield version 2.0.5. Please ensure that you uninstall all other PyG versions first.

willy20040711 commented 2 years ago

I[m also facing the same issue. Win 11 PyG version: 2.0.4 Torch 1.11/ CUDA11.3 installed by conda

rusty1s commented 2 years ago

Using PyG from master is currently only supported through pip.

qingchu123 commented 2 years ago

I have install by this pip install git+https://github.com/pyg-team/pytorch_geometric.git and the version is torch-geometric-2.0.5 and other package is install by pip install torch-scatter torch-sparse torch-cluster torch-spline-conv -f https://data.pyg.org/whl/torch-1.11.0+cu113.html but I still get this fyx@fyx:~/GNN/GraphGym/run$ bash run_single.sh Traceback (most recent call last): File "main.py", line 8, in <module> from graphgym.config import cfg, dump_cfg, load_cfg, set_run_dir, set_out_dir ImportError: cannot import name 'set_out_dir' from 'graphgym.config' (/home/fyx/.local/lib/python3.8/site-packages/graphgym/config.py)

rusty1s commented 2 years ago

It looks like you have https://github.com/snap-stanford/GraphGym installed rather than the version by PyG.

qingchu123 commented 2 years ago

oh I have solved it by remove the graphgym package and run install.sh again,thank you!

linlin0312 commented 1 year ago

Hello, is there any other way to download pyg version 2.5.0? I can't by using this command: pip install git+https://github.com/pyg-team/pytorch_geometric.git

linlin0312 commented 1 year ago

This seems to be indeed caused by the recent changes in #4338. You would need to install PyG from master for this:

pip install git+https://github.com/pyg-team/pytorch_geometric.git

Hello, is there any other way to download pyg version 2.5.0? I can't by using this command: pip install git+https://github.com/pyg-team/pytorch_geometric.git

rusty1s commented 1 year ago

You can install from our nightly builds, see https://github.com/pyg-team/pytorch_geometric#nightly-and-master