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 Error #1526

Closed
hyqyoung opened this issue Aug 13, 2020 · 6 comments
Closed

Import Error #1526

hyqyoung opened this issue Aug 13, 2020 · 6 comments

Comments

@hyqyoung
Copy link

hyqyoung commented Aug 13, 2020

❓ Questions & Help

from torch_geometric.utils import scatter_
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'scatter_'

And I find it that there is no scatter_.py under python3.6/site-packages/torch_geometric/utils

@rusty1s
Copy link
Member

rusty1s commented Aug 13, 2020

The scatter_ call got removed in one of the more recent versions, and you can now simply use torch.scatter(..., reduce='add') for the same effect.

@hyqyoung
Copy link
Author

The scatter_ call got removed in one of the more recent versions, and you can now simply use torch.scatter(..., reduce='add') for the same effect.

Yes, I find the reason is using "pip install torch-geometric" will download the latest version of torch-geometric which is 1.6.1,
but the method "torch_geometric.utils.scatter_" only exists before version 1.4.3 or earlier.
So I just update version 1.4.3 and it works.

@Shakib-IO
Copy link

from torch_geometric.utils import accuracy

cannot import name 'accuracy' from 'torch_geometric.utils' (/usr/local/lib/python3.7/dist-packages/torch_geometric/utils/__init__.py)

@rusty1s
Copy link
Member

rusty1s commented Nov 10, 2022

We dropped support for our metric package and moved to torchmetrics. Where do you see this issue?

@AlanLeAI
Copy link

AlanLeAI commented Apr 4, 2024

I got the issue of
ImportError: cannot import name 'index_sort' from 'torch_geometric.utils' (/Users/tuanle/miniforge3/envs/torch-gpu/lib/python3.8/site-packages/torch_geometric/utils/init.py)

When importing 'import torch_geometric', may I ask If someone can help me out?

I use

pytorch 2.1.0 py3.8_0 pytorch
pytorch-metric-learning 2.5.0 pypi_0 pypi
torch 2.1.0 pypi_0 pypi
torch-cluster 1.6.3 pypi_0 pypi
torch-geometric 2.5.2 pypi_0 pypi
torch-points-kernels 0.6.10 pypi_0 pypi
torch-scatter 2.1.2 pypi_0 pypi
torch-sparse 0.6.18 pypi_0 pypi
torch-spline-conv 1.2.2 pypi_0 pypi
torchaudio 2.1.0 py38_cpu pytorch
torchdata 0.6.1 pypi_0 pypi
torchmetrics 1.2.0 pypi_0 pypi
torchnet 0.0.4 pypi_0 pypi
torchtext 0.15.2 pypi_0 pypi
torchvision 0.16.0 pypi_0 pypi

@rusty1s
Copy link
Member

rusty1s commented Apr 4, 2024

It got moved to

torch_geometric.utils._index_sort

At best, import via

from torch_geometric.utils import index_sort

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

4 participants