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.