Tutorial: CUDA, cuDNN, Anaconda, Jupyter, PyTorch Installation in Windows 10

CUDA, cuDNN, Anaconda, Jupyter, PyTorch in Windows 10

Sik-Ho Tsang
4 min readSep 4, 2021

In this story, the procedures of CUDA, cuDNN, Anaconda, Jupyter, PyTorch Installation in Windows 10, is described. Indeed, the procedures are straightforward. No tricks involved. Let’s get started! (Sik-Ho Tsang @ Medium)

0. GPU & NVIDIA Driver Installation

  • Before all, the computer should‘ve have got a GPU/Display card.
  • Also, normally, NVIDIA driver is installed by NVIDIA experience console.

1. CUDA Installation

1.1. Download

Download CUDA

1.2. Install

  • After downloading, click the exe file to install CUDA:
CUDA installation (I am using Traditional Chinese Windows at home..)
  • Mine is CUDA version 11.4.

1.3. Check

  • You may check the CUDA version that just installed.
  • Open Windows PowerShell and type:
nvcc -V
  • which is the same command as in Ubuntu. CUDA version 11.4 is shown.

2. cuDNN Installation

2.1. Download

  • Go to https://developer.nvidia.com/cudnn.
  • You need to have an account in order to download cuDNN. If no, register one, and go to the above link again.
  • Finally, you got something like this:
  • Click to download the zip file. (Mine is v8.2.4.)

2.2. Install

  • Unzip it.
  • My CUDA installed path is:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vx.x\
  • where vx.x is v11.4.
  • Go to this path. You should see there are 3 directories called “bin”, “include”, and “lib”, which are the same as the unzipped one.
  • Copy the unzipped folders to this path. Then cuDNN is installed.

2.3. Setting Environmental Variables (Optional in my case)

  • In the guideline of NVIDIA, it needs to set the environmental variables, but I do not need to, these are already done. Maybe the guideline is not up-to-date.
  • Below are the steps from the guideline of NVIDIA:
  • Open a command prompt from the Start menu.
    Type Run and hit Enter.
    Issue the control sysdm.cpl command.
    Select the Advanced tab at the top of the window.
    Click Environment Variables at the bottom of the window.
    Ensure the following values are set:
    Variable Name: CUDA_PATH
    Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vx.x

2.4. Use

  • Open the Visual Studio project and right-click on the project name.
  • Click Linker > Input > Additional Dependencies. Add cudnn.lib and click OK.

3. Anaconda & Jupyter Installation

3.1. Download & Install

3.2. Create & Activate Environment

  • Open “Ananconda Powershell Prompt
  • Update the conda
conda update conda
  • Create a new environment. (I normally like to create a new one for a new task.)
  • conda env list can check the list of environments.
conda create — name pytorch_trial_0

conda env list
  • Activate it.
conda activate pytorch_trial_0

3.3. Jupyter Notebook

  • First, Install it:
conda install jupyter
  • jupyter notebook list can check the list of notebook:
jupyter notebook list
  • Create a notebook for development:
jupyter notebook
  • My Google Chrome automatically open the jupyter notebook page for me.
  • If not, just copy the link at the bottom of the PowerShell console.

4. PyTorch Installation

4.1. Download & Install

  • Copy the above command to Ananconda Powershell Prompt and run it, to download & install PyTorch GPU version.
  • (If you only got CPU, choose CPU version at the Computer Platform.)
  • (If you have launched the notebook, you may need to open a new PowerShell to activate the same environment again.)
  • I just directly copy the above command to install:
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge

4.2. Use

  • To test, you may try some Python command to test:
import torch
import torchvision
torch.cuda.is_available()
My Results
  • The library should be properly imported.
  • CUDA should also be checked as available using torch function.

I write this story so that I can repeat it next time easily if needed. :)

--

--

Sik-Ho Tsang

PhD, Researcher. I share what I learn. :) Linktree: https://linktr.ee/shtsang for Twitter, LinkedIn, etc.