rusty1s / pytorch_sparse

PyTorch Extension Library of Optimized Autograd Sparse Matrix Operations
MIT License
1.01k stars 147 forks source link

OSError when importing torch_sparse #252

Closed ParticularlyPythonicBS closed 2 years ago

ParticularlyPythonicBS commented 2 years ago

Hi, I am trying use this library for torch geometric and am currently unable to import it without errors. here is the output when I try to import the library

python -c "import torch_sparse"

--------------------------------------------------------------------
<string> 1 <module>

__init__.py 19 <module>
torch.ops.load_library(spec.origin)

_ops.py 110 load_library
ctypes.CDLL(path)

__init__.py 382 __init__
self._handle = _dlopen(self._name, mode)

OSError:
/home/$USER/anaconda3/lib/python3.9/site-packages/torch_sparse/_version_cuda.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

I installed the package through anaconda usingconda install pytorch-sparse -c pyg

My torch.version.cuda is 11.6 and torch version is 1.12.0.

My NVCC build is Build cuda_11.7.r11.7/compiler.31294372_0

I would appreciate any help in solving this issue

frankhyihe commented 2 years ago

Same issue here. I was using a cpu only machine. The OSError gave the same undefined symbol above.

SergeiShumilin commented 2 years ago

Same issue when importing from torch_geometric.data import Data

/usr/local/lib/python3.7/dist-packages/torch_sparse/_spmm_cpu.so: undefined symbol: _ZNK3c1010TensorImpl36is_contiguous_nondefault_policy_implENS_12MemoryFormatE

ParticularlyPythonicBS commented 2 years ago

Issue fixed by downloading the 11.6 cuda files using pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-1.12.0+cu116.html

I recommend that the readme should reflect the pip package being more updated than the conda one