Search code examples
kagglepytorch-geometricgraph-neural-network

Could not import torch_geometric, it says "undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs"


I am trying to find a solution to the error: OSError: /opt/conda/lib/python3.7/site-packages/torch_sparse/_version_cuda.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs.

arising from the statement from torch_geometric.data import Data in Kaggle notebook.

There are solutions in github and stackoverflow, but none are working.

-- "nvcc --version" shows

"nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2020 NVIDIA Corporation Built on Wed_Jul_22_19:09:09_PDT_2020 Cuda compilation tools, release 11.0, V11.0.221 Build cuda_11.0_bu.TC445_37.28845127_0"

I tried to install torch-geometric by

  1. !conda install pyg -c pyg -c conda-forge

  2. !pip install pyg-lib torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.12.0+cu113.html

from here.

The first statement took more than 1 hour so I moved to the second, which installed it. But the error didn't go.

It is running with out any error in colab.


Solution

  • Looks like there could be various specific culprits to this, but in my case it was simply missing torchtext. Make sure you have that installed and the version is compatible.