Carter Karl Falkenberg
Carter Karl Falkenberg

Reputation: 123

Terminate called after throwing an instance of 'std::bad_alloc' from importing torch_geometric

I am writing in python and getting the error:

"terminate called after throwing an instance of 'std::bad_alloc'.
what(): std::bad_alloc.
Aborted (core dumped)"

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?

Upvotes: 4

Views: 3312

Answers (1)

Carter Karl Falkenberg
Carter Karl Falkenberg

Reputation: 123

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:

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

Simply doing:

Resolves the issue.

Upvotes: 6

Related Questions