Undefined symbol: cusparseSetMatDiagType — PyTorch Source Build & Wheels Fail on JetPack 6.2 (Orin NX)

Hi NVIDIA Jetson team,

I’m unable to get any CUDA-enabled PyTorch (source-built or wheels) to import on JetPack 6.2 (Orin NX 16GB) due to a missing cuSPARSE symbol:

ImportError: /home/nvidia/XEYE/.venv/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so:
undefined symbol: cusparseSetMatDiagType, version libcusparse.so.12

This happens immediately on import torch:

import torch
print(torch.version)
print(torch.cuda.is_available())

System Info

$ cat /etc/nv_tegra_release
R36 (release), REVISION: 4.1, GCID: 36213792, BOARD: t186ref, EABI: aarch64, DATE: Wed Oct 23 15:03:35 UTC 2024

$ nvcc --version
Cuda compilation tools, release 12.6, V12.6.77

$ python --version
Python 3.10.12

$ uname -a
Linux nvidia-desktop 5.15.0-1031-nvidia #31 SMP PREEMPT_DYNAMIC Wed Oct 23 15:03:35 UTC 2024 aarch64

Current cuSPARSE State

$ ls -l /usr/local/cuda-12.6/lib64/libcusparse.so.12*
lrwxrwxrwx 1 root root 65 Oct 24 08:43 /usr/local/cuda-12.6/lib64/libcusparse.so.12 → /usr/local/cuda/targets/aarch64-linux/lib/libcusparse.so.12.5.4.2
-rw-r–r-- 1 root root 102204552 Oct 24 07:36 /usr/local/cuda-12.6/lib64/libcusparse.so.12.5.4.2

What I’ve Tried (Complete History)

1. Prebuilt Wheels from Jetson AI Lab

pip install torch==2.8.0 --index-url https://pypi.jetson-ai-lab.dev/jp6/cu126

→ torch-2.8.0-cp310-cp310-linux_aarch64.whl
→ Fails with: libcusparse.so.12: cannot open shared object file
→ Fixed via: sudo apt install cuda-libraries-12-6 + symlink
→ Still fails with undefined symbol: cusparseSetMatDiagType

pip install torch-2.5.0a0+872d972e41.nv24.08-cp310-cp310-linux_aarch64.whl

→ Same error: undefined symbol: cusparseSetMatDiagType

2. Built PyTorch from Source

git clone --recursive GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration
cd pytorch
export USE_CUDA=1 TORCH_CUDA_ARCH_LIST=8.7 MAX_JOBS=4
python setup.py develop

→ Build succeeded
→ Same error on import

3. Attempted cuSPARSE Upgrade

sudo apt install --reinstall cuda-libraries-12-6
sudo apt full-upgrade -y

→ Latest result:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

→ Still on libcusparse.so.12.5.4.2

4. Manual .deb Extraction

Downloaded cuda-cusparse-dev-12-6_12.6.68-1_arm64.deb
Extracted libcusparse.so.12.6.68
Copied and fixed symlinks
Symbol still missing — no change

5. Other Attempts

cuda-toolkit-12-6, cuda-compat-12-6, cusparseLt → no effect
sudo ldconfig, reboot → no change

Question

  1. How do I force-install libcusparse.so.12.6.x on JetPack 6.2?
  2. Is this a known ABI mismatch between Jetson wheels/source and L4T?
  3. Should source builds be avoided on JP 6.2?
  4. Is there a patched L4T update or special .deb with updated cuSPARSE?

I need CUDA acceleration for Detectron2 + custom kernels. Happy to use wheels if they work. I’ve been working on this for 4 days now and i still can’t make it work. Any help would be much appreciated. Thanks!

Hi,

Please use the packages from PyTorch directly.
The command will automatically install the dependencies as well.

$ pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126 --force-reinstall

Please check the installation command below.
Thanks.

Hi, thanks for that.

I did try that too, but I forgot to put it in the initial message.

In any case, I tried it again and it worked:

Successfully installed MarkupSafe-2.1.5 filelock-3.19.1 fsspec-2025.9.0 jinja2-3.1.6 mpmath-1.3.0 networkx-3.3 numpy-2.1.2 nvidia-cublas-cu12-12.6.4.1 nvidia-cuda-cupti-cu12-12.6.80 nvidia-cuda-nvrtc-cu12-12.6.77 nvidia-cuda-runtime-cu12-12.6.77 nvidia-cudnn-cu12-9.10.2.21 nvidia-cufft-cu12-11.3.0.4 nvidia-cufile-cu12-1.11.1.6 nvidia-curand-cu12-10.3.7.77 nvidia-cusolver-cu12-11.7.1.2 nvidia-cusparse-cu12-12.5.4.2 nvidia-cusparselt-cu12-0.7.1 nvidia-nccl-cu12-2.27.5 nvidia-nvjitlink-cu12-12.6.85 nvidia-nvshmem-cu12-3.3.20 nvidia-nvtx-cu12-12.6.77 pillow-11.3.0 sympy-1.14.0 torch-2.9.0+cu126 torchvision-0.24.0 triton-3.5.0 typing-extensions-4.15.0
(.venv) nvidia@nvidia-desktop:~/XEYE$ /home/nvidia/XEYE/.venv/bin/python /home/nvidia/XEYE/torch_check.py
2.9.0+cu126
True

However, when I try running my main script, this error (which I now remember, and is the reason why I opted to try to install a different torch build) occurs:

(.venv) nvidia@nvidia-desktop:~/XEYE$ /home/nvidia/XEYE/.venv/bin/python /home/nvidia/XEYE/main.py
Traceback (most recent call last):
.....
torch.AcceleratorError: CUDA error: no kernel image is available for execution on the device
Search for `cudaErrorNoKernelImageForDevice' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information.
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

Is this an issue with pytorch or detectron2?

Thanks.

Hi, AastaLLL

Are there any updates on this? I tried using YOLOV11 instead of Detectron2 but the same error occurs.

Thanks.

Hi,

Sorry for the incorrect information.
Please try to install with the command below:

$ pip3 install torch torchvision --index-url https://pypi.jetson-ai-lab.io/jp6/cu126 --force-reinstall
$ python3
Python 3.10.12 (main, Feb  4 2025, 14:57:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True
>>> torch.rand(10).to(torch.device("cuda"))
tensor([0.2206, 0.4533, 0.0640, 0.6616, 0.0214, 0.2479, 0.5947, 0.7375, 0.7313,
        0.9199], device='cuda:0')

Thanks.

I still got the same result.

Successfully installed MarkupSafe-3.0.3 filelock-3.20.0 fsspec-2025.9.0 jinja2-3.1.6 mpmath-1.3.0 networkx-3.4.2 numpy-2.2.6 pillow-12.0.0 sympy-1.14.0 torch-2.8.0 torchvision-0.23.0 typing-extensions-4.15.0
(.venv) nvidia@nvidia-desktop:~/XEYE$ python3
Python 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nvidia/XEYE/.venv/lib/python3.10/site-packages/torch/__init__.py", line 422, in <module>
    from torch._C import *  # noqa: F403
ImportError: /home/nvidia/XEYE/.venv/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so: undefined symbol: cusparseSetMatDiagType, version libcusparse.so.12

Hi,

Could you check if the following library is installed in your environment?

/usr/lib/aarch64-linux-gnu/libcusparseLt/12/libcusparseLt.so.0

If not, please install it with the commands in the link below:

Thanks.