Terminate called after throwing an instance of 'std::bad_alloc' from importing torch_geometric
I am writing in python and getting the error:
&quot;terminate called after throwing an instance of 'std::bad_alloc'.
what():  std::bad_alloc.
Aborted (core dumped)&quot;
After lots of debugging, I found out the source of the issue is:
import torch_geometric

I even created a file with just this line of code, and I still get the error.
I am running in a conda environment (4.10.3)
I made sure that I installed torch_geometric while I was in the conda environment. I tried deleting and reinstalling, but this did not work.
I also tried deleting and reinstalling torch/cuda.
I googled the error, but only seemed to come up with issues in data allocation, but I'm not sure how this would be an issue, since I am just importing torch_geometric.
Any ideas?

This problem is because of mismatched versions of pytorch.
The current pytorch being used is 1.11.0, but when scatter and sparse were installed installed scatter and sparse, 1.10.1 were used:

pip install torch-scatter -f https://data.pyg.org/whl/torch-1.10.1+cu113.html.
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.10.1+cu113.html

So,torch-1.10.1 was used to install scatter and sparse, but torch-1.11.0 was the true version.
Simply doing:

pip uninstall torch-scatter
pip uninstall torch-sparse
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+cu113.html.
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.11.0+cu113.html

Resolves the issue.
