If you want to run programs on your computer that require GPU acceleration (like AI software), you might need to install CUDA.
CUDA is a tool from NVIDIA that allows your graphics card to do more work. This article will guide you step-by-step on how to install CUDA 12.6 and the corresponding cuDNN 9.8 on Windows 10.
Why choose CUDA 12.6 instead of 12.8? Because 12.8 is the latest version, and some software might not be fully compatible with it yet, leading to compatibility issues. CUDA 12.6 is a relatively stable and up-to-date version. Of course, if you want 12.4 or 12.8, the installation method is similar; you can adjust the version number based on this tutorial.
Don't worry, even if you have no technical background, you can follow these steps and get it done! Let's get started!
Step 1: Check if Your Graphics Card is NVIDIA
Open Device Manager
- Right-click the "Start" button (the Windows icon) in the bottom-left corner of your desktop.
- In the pop-up menu, select "Windows Administrative Tools-Computer Management," which will open a window.
Find Graphics Card Information
In the Computer Management window, click "Device Manager" on the left, and find "Display adapters" on the right. Click the small arrow in front of it to expand.
Check if there's "NVIDIA" in the list, like "NVIDIA GeForce GTX 1660."
If yes, congratulations, your graphics card is NVIDIA, and you can continue. If not (e.g., "Intel" or "AMD"), CUDA won't work, and this tutorial ends here.
Step 2: Check and Update Your Graphics Card Driver Version
Open NVIDIA Management Software
If you've installed the graphics card driver, there might be a green "NVIDIA" icon in the taskbar (next to the time) in the bottom-right corner of your desktop. Right-click it and select "NVIDIA GeForce Experience" to open.
If not, skip to step 3 to download manually.
Check Driver Version and Update
- After opening, click "Drivers" in the top-left corner.
- It will display the current driver version (e.g., "546.33"). If there's a new version, there will be a "Download" button.
- Click "Download" and follow the prompts to install. Restart your computer after installation.
No Software? Manually Download the Driver
- Open your browser and enter the website: https://www.nvidia.com/en-us/geforce/drivers/ to download the driver update software, and then install it.
- After installing, open it and follow the instructions to check for driver updates.
Step 3: Check if CUDA is Already Installed and Determine the Maximum Supported Version
- Open Command Prompt (CMD)
- Press the Windows key + R on your keyboard, and the "Run" window will pop up.
- Enter
cmd
and press Enter to open a black command-line window.
Check CUDA Version
- In the command line, enter:
nvcc -V
Press Enter. If it displays something like
Cuda compilation tools, release 12.6, V12.6.xxx
, it means CUDA is already installed, and the version is 12.6. If it displays "is not recognized as an internal or external command," it means it hasn't been installed; continue with the installation steps below.- In the command line, enter:
View the Maximum Supported CUDA Version
- In the command line, enter:
nvidia-smi
Press Enter. A table will be displayed, and the top-right corner will show "CUDA Version" (e.g., 12.6 or higher). This indicates the highest version supported by your driver. As long as it's 12.6 or above, you can install the CUDA 12.6 we want.
- In the command line, enter:
Step 4: Download and Install CUDA 12.6
- Download CUDA 12.6
- Open your browser and go to the NVIDIA official download page: https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local
- Select "Windows" > "x86_64" > "10" > "exe (local)", and click "Download".
- The filename will be something like
cuda_12.8.1_572.61_windows.exe
, and it will be downloaded to your "Downloads" folder.
- Install CUDA (Custom Mode)
Double-click the downloaded file, and the installation window will pop up. Agree to the agreement and click "Next".
Select "Custom (Advanced)" installation and click "Next".
In the options list, only check "CUDA" in the first row, and uncheck all other options to avoid conflicts.
Then click the
+
sign in front ofCUDA
and uncheckVisual Studio Integration
, otherwise the installation is prone to failureClick "Next" and follow the prompts to complete the installation. The default path is
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6
.
What to Do if You Encounter Errors?
- If the installation is interrupted and prompts "Not installed" or "Failed," it might be because the options were not selected correctly. Re-run the installation program, select custom installation, and make sure only "CUDA" in the first row is selected, and all others are unchecked, and open CUDA to uncheck
Visual Studio Integration
. - If the error persists, skip to the next step to install Visual Studio.
- If the installation is interrupted and prompts "Not installed" or "Failed," it might be because the options were not selected correctly. Re-run the installation program, select custom installation, and make sure only "CUDA" in the first row is selected, and all others are unchecked, and open CUDA to uncheck
Step 5: Install Visual Studio (If CUDA Installation Fails)
If you unchecked
Visual Studio Integration
in the previous step, there should be no errors. If there are errors, please install Visual Studio accordingly.
Download Visual Studio Community Edition
- Open your browser and go to: https://visualstudio.microsoft.com/zh-hans/free-developer-offers/
- Click "Free download Visual Studio Community" (Community Edition) to download the installer.
Install C++ Development Environment
- Double-click the installer. After the window pops up, select "Desktop development with C++".
- Click "Install". This may take several tens of minutes. Restart your computer after installation.
- Reinstall CUDA 12.6
- Go back to step 4 and re-run the CUDA installation program. Select only "Runtime" in custom mode to install. This time, it should be successful.
Step 6: Verify CUDA Installation and Configure Environment Variables
Check if the Installation is Successful
- Open CMD (Windows key + R, enter
cmd
). - Enter:
nvcc -V
If it displays
Cuda compilation tools, release 12.6, V12.6.xxx
, it means the installation was successful. If it prompts "is not recognized as an internal or external command," you need to add environment variables.
- Open CMD (Windows key + R, enter
Add CUDA to Environment Variables
- Right-click "This PC", select "Properties" > "Advanced system settings" > "Environment Variables".
- In the "System variables" section, in "Path", click "New" and enter:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\lib C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\include C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\libnvvp
- Click "OK" to save and close all windows.
- Reopen CMD, enter
nvcc -V
, and you should see the version information.
Step 7: Install cuDNN 9.8
- Download cuDNN 9.8
- Open your browser and go to: https://developer.nvidia.com/cudnn-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local
- You might need to log in to your NVIDIA account (register for free if you don't have one).
- Select "local version" and download the
.exe
file for Windows.
- Install cuDNN
- Double-click the downloaded
.exe
file and follow the prompts to install.
- Double-click the downloaded
If cuDNN cannot be used in the program after installation, you can open the installation directory, default
C:\Program Files\NVIDIA\CUDNN\v9.8
, copy thelib
bin
include
these 3 folders, copy toC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6
to overwrite.
Finally: Congratulations!
Now CUDA 12.6 and cuDNN 9.8 are installed! You can start running programs that require GPU support. If there are software instructions (like running python script.py
), enter the project folder in CMD and try entering the corresponding command.