pytorch_geometric: Jupiter kernel dies when importing pytorch geometric

🐛 Describe the bug

Hi everyone,

I have just installed PyTorch geometric in a virtual machine that is Linux Ubuntu, the virtual machine is on a CPU. I used the terminal to just install it and it gave me the message that the

pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.1+cpu.html
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.12.1+cpu.html
pip install torch-geometric

However, when I launch anaconda and I use Jupiter, I just execute this snippet the kernel dies

import os
import torch
import matplotlib.pyplot as plt
from torch_geometric.datasets import Planetoid
from torch_geometric.transforms import NormalizeFeatures

However, I already use torch and it works ok, and apparently, it is PyTorch geometric that makes crash the kernel

Environment

  • PyG version: the latest
  • PyTorch version: 1.12.1
  • OS:
  • Python version: 3.7
  • CUDA/cuDNN version: CPU
  • How you installed PyTorch and PyG (conda, pip, source): Terminal
  • Any other relevant information (e.g., version of torch-scatter):

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 31 (11 by maintainers)

Most upvoted comments

I was having the same issue - debugged through and the issue seems to be inside this line in the initialization of pytorch_geometric/data/data.py:

from torch_sparse import SparseTensor

Tracing that through the root issue seems to be in torch_sparse calling torch.ops.load_library(spec.origin), where spec.origin is /home/john/.local/lib/python3.10/site-packages/torch_sparse/_version_cuda.so, and not quite sure how to decode that binary to debug further.

In the end I just downgraded to Python 3.6 and installed via pip instead of conda and the issue didn’t seem to persist.

Import torch does not problem and I managed before to run a neural network with torch, so I have found weird this behaviour