Updated Answer:
I used this command and it worked like a charm!
!pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.3.0+cu121.html
Historical Answer:
I had the same problem with Google Colab.
When I checked torch version using:
import torch
torch.__version__
I got 2.3.1+cu121
. The latest version of torch-sparse
(as of today!) works with torch-2.1.0
. So I uninstalled the current torch, and installed the correct version:
!pip uninstall torch
!pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
You might need to restart your session for the changes to affect.
And after that as mentioned in previous answers:
!pip uninstall torch-scatter torch-sparse torch-geometric torch-cluster --y
!pip install torch-scatter -f https://data.pyg.org/whl/torch-2.1.0+cu121.html
!pip install torch-sparse -f https://data.pyg.org/whl/torch-2.1.0+cu121.html
!pip install torch-cluster -f https://data.pyg.org/whl/torch-2.1.0+cu121.html
!pip install git+https://github.com/pyg-team/pytorch_geometric.git
It worked like a charm for me! I hope it helps you too!
Just keep in mind that in the future torch-sparse might get updated to the latest torch version and you don't need to downgrade your torch version.
torch-scatter
usingpip install --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.1.html
However I receive an error ERROR: Could not find a version that satisfies the requirement torch-scatter (from versions: none) ERROR: No matching distribution found for torch-scatter even though my PyTorch version is 1.7.1 and I have no cuda. Do you know what is the reason? – Jasun