rana
rana

Reputation: 91

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.

Upvotes: 2

Views: 6628

Answers (4)

DanCar
DanCar

Reputation: 31

I'm using debian test. Had same issuing using torchtext. Solved this by installing the cuda 12.4 version rather than the cuda 12.1 version.

pip3 install torch torchtext torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

Command retrieved from: https://pytorch.org/get-started/locally/ The regular pip install, installs cuda version 12.1.

Prior to this I uninstalled my local version of cuda, which may have been a factor. After the fix, reinstalling local cuda did not reintroduce the issue.

Upvotes: 0

yash
yash

Reputation: 380

Had to go through a lot of issues setting up the pytorch_geometric environment, the best way to setup a reproducible environment so far I could build is using conda-forge channel exclusively for all pytorch related packages, using the following commands

conda create --name yourenvname python=3.10 -c conda-forge
conda activate yourenvname
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install pytorch pytorch_geometric pytorch_scatter pytorch_sparse

NOTE: involves prioritizing the conda-forge over the default channel (totally worth it!) and I only tested it on a cpu environment

Upvotes: 1

SmOg3R
SmOg3R

Reputation: 294

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.

Upvotes: 2

François Landes
François Landes

Reputation: 758

This issue is mentionned at https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html :

undefined symbol: make_function_schema: This issue signals (1) a version conflict between your installed PyTorch version and the ${TORCH} version specified to install the extension packages, or (2) a version conflict between the installed CUDA version of PyTorch and the ${CUDA} version specified to install the extension packages. Please verify that your PyTorch version and its CUDA version match with your installation command:

python -c "import torch; print(torch.__version__)"
python -c "import torch; print(torch.version.cuda)"
nvcc --version

For re-installation, ensure that you do not run into any caching issues by using the pip --force-reinstall --no-cache-dir flags. In addition, the pip --verbose option may help to track down any issues during installation. If you still do not find any success in installation, please try to install the extension packages from source.

So, I would try these commands, and re-install all or part of the packages into a fresh environment.

Upvotes: 2

Related Questions