pytorch_geometric icon indicating copy to clipboard operation
pytorch_geometric copied to clipboard

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

Open angup143 opened this issue 2 years ago • 8 comments

🐛 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

  • PyG version: 2.0.4
  • PyTorch version: 1.10.0
  • OS: Linux
  • Python version:
  • CUDA/cuDNN version:
  • How you installed PyTorch and PyG (conda, pip, source): pip
  • Any other relevant information (e.g., version of torch-scatter):

angup143 avatar Mar 28 '22 18:03 angup143

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

rusty1s avatar Mar 29 '22 06:03 rusty1s

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

shahfasal avatar May 24 '22 07:05 shahfasal

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

rusty1s avatar May 24 '22 12:05 rusty1s

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

willy20040711 avatar May 26 '22 07:05 willy20040711

Using PyG from master is currently only supported through pip.

rusty1s avatar May 26 '22 12:05 rusty1s

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)

qingchu123 avatar Jun 19 '22 15:06 qingchu123

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

rusty1s avatar Jun 19 '22 15:06 rusty1s

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

qingchu123 avatar Jun 20 '22 01:06 qingchu123

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 avatar Sep 08 '23 09:09 linlin0312

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

linlin0312 avatar Sep 08 '23 09:09 linlin0312

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

rusty1s avatar Sep 11 '23 10:09 rusty1s