Posted on March 26, 2025
I was using CUDA 12.1 in my Ubuntu machine, but I needed to use CUDA 11.6 to run Gausian Splatting. Indeed, I tried installing dependent packages with CUDA 12.1, but it didn't work. So, I decided to install CUDA 11.6 in my machine and switch between different CUDA versions.
First, you need to download the CUDA toolkit from the CUDA Toolkit Archive. In my case, I downloaded the CUDA 11.6 toolkit for Ubuntu 18.04. Note that you need to download the runfile (local) version, like this picture, to install CUDA manually.
After installing the CUDA toolkit, you need to set the environment variables, which are CUDA_HOME
, PATH
, and LD_LIBRARY_PATH
, and run source ~/.bashrc
.
Here is an example of setting the environment variables for CUDA 11.6.
export CUDA_HOME=/usr/local/cuda-11.6
export PATH="/usr/local/cuda-11.6/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.6/lib64:$LD_LIBRARY_PATH"
Note that this will append the CUDA 11.6 paths to the existing paths, which might cause conflicts if you have already set paths for different CUDA versions. In such cases, you can create a script that replaces existing paths with the new paths.
* Added on June 5, 2025: if you want to replace a certain version in your environment variables, you can use the following script:
export PATH=${PATH//\/usr\/local\/cuda-12.1\/bin/\/usr\/local\/cuda-11.6\/bin}
This will replace the existing CUDA 12.1 paths with the new CUDA 11.6 paths in your PATH
variable.
Of course, you can do the same for other variables like LD_LIBRARY_PATH
and CUDA_HOME
as well.