WSL2 Setup
1. Install CUDA Toolkit
WSL2 uses the NVIDIA driver which is installed in your Windows host. As such, you should ensure that you do not install a NVIDIA driver in your WSL2 distribution. More information about WSL2 and using CUDA can be found on this page CUDA Toolkit - WSL2.
For installation instructions, you can refer to the following links:
CUDA Toolkit 13.0, if you have driver r580 or later
CUDA Toolkit 12.8, if you have driver r525 or later
2. Setup Environment Variables
Once you have CUDA Toolkit installed, you need to setup the following environment variables in your WSL2 distribution.
export CUDA_PATH=/usr/local/cuda
export PATH=$CUDA_PATH/bin:$PATH
export LIBRARY_PATH=$CUDA_PATH/lib64/stubs:$CUDA_PATH/lib64:$LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_PATH/lib64:$LD_LIBRARY_PATH
You can use these commands to updates the environment variables from your ~/.bashrc file automatically.
echo 'export CUDA_PATH=/usr/local/cuda' >> ~/.bashrc
echo 'export PATH=$CUDA_PATH/bin:$PATH' >> ~/.bashrc
echo 'export LIBRARY_PATH=$CUDA_PATH/lib64/stubs:$CUDA_PATH/lib64:$LIBRARY_PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$CUDA_PATH/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
3. Install CV-CUDA
Once you have completed the above steps, you can install CV-CUDA in your WSL2 distribution. Please refer to the Installation guide for detailed instructions on installing CV-CUDA. A summary of the installation methods is provided below.
Method 1: Install from PyPI (Recommended)
You can install CV-CUDA from PyPI using the following command:
python3 -m pip install cvcuda-cu<CUDA_VERSION>
where <CUDA_VERSION> is the desired CUDA version, cu12 or cu13.
For example, to install CV-CUDA for CUDA 12:
python3 -m pip install cvcuda-cu12
See Python Wheels from PyPI for more details.
Method 2: Install from Pre-built Packages
Download and install Debian packages or tar archives from the CV-CUDA GitHub Releases page.
For Debian packages (.deb), see Debian Packages and Tar Archives
For tar archives (.tar.xz), see Debian Packages and Tar Archives
Method 3: Build from Source
For building CV-CUDA from source in WSL2, follow the Building from Source instructions.