ImportError while installing mamba-ssm

I am trying to install mamba-ssm package through pip install mamba-ssm but I got the following error:

ImportError: /tmp/pip-build-env-wl_dvsa4/overlay/lib/python3.12/site-package/torch/lib/../../nvidia/cusparse/lib/libcusparse.so.12: symbol __nvJitLinkComplete_12_4 version libnvJitLink.so.12 not defined in file libnvJitLink.so.12 with link time reference

The last import before the error: from torch._C import *, even tho the same import works fine when I call it separately.
Then I tried to install it through downloading the github package and running the setup.py file, but I got another error (older version of GCC, you need GCC 9 or newer).

my setup contains the following:
x86 PC with nvidia titan GPU
ubuntu 18.04
cudatoolkit 12.0
python 3.12
pytorch 2.5.1
pytorch-cuda 12.1

I am really lost now, Any Help Would be Appreciated.

It seems you are trying to mix various CUDA libs from 12.0, 12.1, and 12.4 and I would recommend sticking to a single one.

1 Like

Thank you so much for your help.

I did not intend to install different CUDA libs, I installed CUDA toolkit 12.0, but then there wasn’t a similar version for pytorch-cuda, so I installed pytorch-cuda 12.1 instead. For the libcusparse 12.4, it was automatically installed by the pip install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia.
Anyway for future readers, the different CUDA libs was not the problem in my case, I solved the problem by updating the GCC and G++ libs in my ubuntu OS from 7.5. into 9.0 using the following commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-9
sudo apt install g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9

then I installed the mamba-ssm package locally by downloading the GitHub repo and opening a terminal in the same folder and python setup.py install command.

I hope this post helps.