ImportError: libcusparseLt.so.0: cannot open shared object file: No such file or directory

Hello,
Recently I updated CUDA version to 12.2 in my machine (Ubuntu 22.04).

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05             Driver Version: 535.104.05   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 4050 ...    On  | 00000000:01:00.0  On |                  N/A |
| N/A   37C    P8               1W /  60W |     21MiB /  6141MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2031      G   /usr/bin/gnome-shell                          1MiB |
+---------------------------------------------------------------------------------------+

I installed pytorch in a conda virtual environment using the latest version:
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia

And, when I try to run import pytorch I get the following error message:
ImportError: libcusparseLt.so.0: cannot open shared object file: No such file or directory

So, I checked checking inside /usr/local/cuda with find -name libcusparse* and I effectively don’t have that file.

./targets/x86_64-linux/lib/libcusparse.so.12.1.2.141
./targets/x86_64-linux/lib/libcusparse_static.a
./targets/x86_64-linux/lib/libcusparse.so
./targets/x86_64-linux/lib/stubs/libcusparse.so
./targets/x86_64-linux/lib/libcusparse.so.12

So my question is, should I install that file from the following url: cuSPARSELt Downloads | NVIDIA Developer ? Or is this an issue from pytorch? I ask this because I have another conda environment where I can actually run import torch which I installed the 2023-09-25 by checking the list of conda revisions, without issues. However, if I run torch.cuda.is_available() I get False. Which is again weird because the first week of this month (October 2023) I didn’t have this issue. The only changes I remember are a package I installed via pip like pylabel. And I updated conda recently.

Complementing even more, I just found another conda environment which has the following version of pytorch:
pytorch 2.2.0.dev20230913 py3.8_cuda12.1_cudnn8.9.2_0 pytorch-nightly

Which I installed the 2023-09-13, and when I run:

import torch
torch.cuda.is_available()

I get True. What’s causing this issue?

This week I did the same exercise and it’s working fine.

I guess you need to install libcudasparseLt. Use this link: https://developer.nvidia.com/cusparselt-downloads

Installing cuda toolkit 11.7 fixed this for me.

Hi! I have encountered this same issue for a while now, and i can not seem to get rid of it. i did try installing libcudasparseLt from the link provided but that does not work either. Could you ultimately get this issue to work?

Which PyTorch release are you using?

I cannot reproduce any issue using PyTorch 2.6.0 and see the right libcusparseLt.so is opened from the pip wheel during import torch:

LD_DEBUG=libs python -c "import torch"
...
calling init: /usr/local/lib/python3.12/dist-packages/torch/lib/../../cusparselt/lib/libcusparseLt.so.0

Your repo link points to an SSO so you might want to remove it.