cupy: Cannot find libcutensor.so.2

Description

Recently, I noticed two issues related to cutensor in CuPy.

When I run import cupy_backends.cuda.libs.cutensor, I got the following error

libcutensor.so.2: cannot open shared object file: No such file or directory

However, cutensor-cu12 is already installed via pip. This issue is probably introduced recently. It does not appear in the earlier versions.


When I run import cupy.cuda.cutensor, the following warning is raised

You can install the library by:
  $ pip install "cutensor-cu12~=2.1.0"

  warnings.warn(f'''

However, the binary package of cutensor-cu12 v2.1.0 is not released in PyPI.

To Reproduce

pip3 install cupy-cuda12x pip3 install cutensor-cu12

import cupy.cuda.cutensor

Installation

Wheel (pip install cupy-***)

Environment

OS                           : Linux-5.4.250-2-velinux1u1-amd64-x86_64-with-glibc2.31
Python Version               : 3.10.15
CuPy Version                 : 13.4.0
CuPy Platform                : NVIDIA CUDA
NumPy Version                : 2.1.3
SciPy Version                : 1.15.2
Cython Build Version         : 3.0.12
Cython Runtime Version       : None
CUDA Root                    : /usr/local/cuda
nvcc PATH                    : /usr/local/cuda/bin/nvcc
CUDA Build Version           : 12080
CUDA Driver Version          : 12040
CUDA Runtime Version         : 12080 (linked to CuPy) / 12040 (locally installed)
CUDA Extra Include Dirs      : []
cuBLAS Version               : 120405
cuFFT Version                : 11201
cuRAND Version               : 10305
cuSOLVER Version             : (11, 6, 1)
cuSPARSE Version             : 12301
NVRTC Version                : (12, 4)
Thrust Version               : 200800
CUB Build Version            : 200800
Jitify Build Version         : <unknown>
cuDNN Build Version          : None
cuDNN Version                : None
NCCL Build Version           : 22501
NCCL Runtime Version         : 22105
cuTENSOR Version             : None
cuSPARSELt Build Version     : None
Device 0 Name                : NVIDIA A100-SXM4-80GB
Device 0 Compute Capability  : 80
Device 0 PCI Bus ID          : 0000:6B:02.0

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (11 by maintainers)

Most upvoted comments

FYI, cutensor 2.2.0 wheel is just released on PYPI

A few updates from cuTensor team:

  1. cuTensor is committed to ABI compatibility within the major version, so we would recommend CuPy to just ping at major version 2.
  2. cuTensor will skip the PyPI release for version 2.1.0 (already released in conda), but a 2.2.0 release on all channels is expected within days/weeks.

Thanks for the update, @yangcal! I’ve fixed the logic to allow loading any of cuTENSOR 2.* wheels (#9030).

I can reproduce the issue.

The behaviour between cupy versions 13.3 and 13.4 seems to be different (cupy 13.3 looks for it inside the environments site-packages, 13.4 doesn’t).

I originally planned to include #9030 as a part of hot-fix release (v13.4.1) planned this week, but now that cuTENSOR 2.2 is out, I now think it’s not mandatory for the hot-fix.

It seems that I have cutensor in my LD_LIBRARY_PATH so my finding below is not accurate. I can reproduce now.

Hello, I’m not able to reproduce the failure.

With a fresh conda environment, the installation worked just fine for me and I was able to import cutensor using both import cupy.cuda.cutensor and import cupy_backends.cuda.libs.cutensor

conda create -n cupy python=3.10
conda activate cupy
pip install cupy-cuda12x cutensor-cu12

and below is my full pip list:

Package       Version
------------- -------
cupy-cuda12x  13.4.0
cutensor-cu12 2.0.2
fastrlock     0.8.3
numpy         2.2.3
pip           25.0
setuptools    75.8.0
wheel         0.45.1

I also checked the cutensor version runtime, e.g, cutensor.get_version() and it’s matching the latest 2.0.2 pypi release