'How to download an older version of PyTorch Geometric in Google Colab?

Question: How can I download an older version of PyTorch geometric in google colab?

Context: I am trying to use/load a pytorch-geometric graph and am getting the error message: "RuntimeError: The 'data' object was created by an older version of PyG. If this error occurred while loading an already existing dataset, remove the 'processed/' directory in the dataset's root folder and try again." This graph was generated during summer 2021.

I am using PyTorch and the following code to import Pytorch geometric, but am still getting the error when using older versions.

#import torch
!pip install torch==1.8.0
import torch
torch.__version__

!pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.8.0+cpu.html

I am not sure whether I am using the correct older version of pytorch-geometric (I don't really know how to check whether this is correct). Any insight to would be greatly appreciated:

  • How to download older version of pytorch geometric?
  • What is causing this error?

Thanks in advance.



Solution 1:[1]

I'm not sure if you still need it but I just ran into the same problem and here's what I found:

  1. It seems like there isn't a compatibility document but you can check the version history here and find the corresponding release for the one nearest to the time when your pytorch version was released, of course this doesn't guarantee compatibility but I think you have a pretty good chance?

  2. For the additional packages e.g. torch-scatter, you can find the corresponding versions here and install from the .whl files.

Solution 2:[2]

You may not need to downgrade: If G is a graph data object giving this error you can simply convert it as follows.

from torch_geometric.data import Data
G = Data(**G.__dict__)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tangolin
Solution 2 user2382938