Torch_sparse cannot find cuda lib file from pytorch

I am trying to reproduce a previous work that used pytorch 1.4.0+cu100, and torch_sparse 0.6.1. However, after I run the model, the error message

OSError: libcusparse.so.10.0: cannot open shared object file: No such file or directory

is produced under one of torch_sparse function. I thought that pytorch is shipped with cuda dependencies, or is it not true for the older pytorch versions. So, I’m not sure what is the problem with my set up.

Which CUDA runtime version is used in the torch_sparse build as it seems it might not be compatible with the ones shipped with PyTorch 1.4?

I’m not sure how to check the CUDA runtime used. However, as per the instruction from the project (GitHub - gomes-lab/Mat2Spec) I want to reproduce, I used the wheel file https://data.pyg.org/whl/torch-1.4.0/torch_sparse-0.6.1%2Bcu100-cp38-cp38-linux_x86_64.whl to install torch_sparse which should be CUDA 10.0?

I don’t know if torch_sparse depends on a locally installed CUDA toolkit, but installing the version you’ve mentioned together with torch==1.4.0+cu101 fails directly with:

python -c "import torch; import torch_sparse"
...
OSError: libcudart.so.10.0: cannot open shared object file: No such file or directory

Pointing to a missing libcudart.so.
The PyTorch binaries ship with their own CUDA runtime lib as:

.../site-packages/torch/lib/libcudart-1b201d85.so.10.1

adding the SHA value into its name to avoid conflicts during lazy loading.
Since torch_sparse tries to load libcudart.so directly and does not ship with it:

ls .../site-packages/torch_sparse
__init__.py  _convert.so  _metis.so  _saint.so  _spspmm.so   add.py  coalesce.py  diag.py  index_select.py   matmul.py  mul.py     permute.py  rw.py     select.py  spspmm.py   tensor.py     utils.py
__pycache__  _diag.so     _rw.so     _spmm.so   _version.so  cat.py  convert.py   eye.py   masked_select.py  metis.py   narrow.py  reduce.py   saint.py  spmm.py    storage.py  transpose.py

I assume a locally installed CUDA toolkit was needed in this older release.

Thanks for your answer. Would there be any conflict if I install CUDA toolkit for 10.0 along side 11.8 in my local machine? since most of my projects use 11.8.

No, you can install multiple CUDA toolkits locally and can create the /usr/local/cuda symlink to the version you want to use.

1 Like