Configuring Deep Learning Environment with Anaconda, PyTorch, CUDA, and cuDNN

Setting up a deep learning environment involves several key components: Anaconda for virtual environments, CUDA and cuDNN for GPU acceleration, PyCharm as an integrated development environment (IDE), and PyTorch as the machine learning framework.

Anaconda Installation

Visit the Anaconda official site to download the Windows installer. After downloading, run the executable and proceed through the installation wizard. Choose "All Users" during setup if you want to make it accessible system-wide. Select the default installation directory or specify a custom one. Ensure Python 3.9 is installed by default. Once complete, verify the installation by opening a command prompt and typing conda. If successful, the terminal will display conda's version information.

CUDA and cuDNN Setup

First, determine your maximum supported CUDA version using nvidia-smi in the command prompt. Visit the CUDA Toolkit Archive page to download the appropriate version (e.g., 11.3). Run the installer and choose a custom installation path. Select all components including the CUDA samples and toolkit.

For cuDNN, navigate to the NVIDIA cuDNN download page. Register for an account if necessary, then download the matching version. Extract the contents of the cuDNN zip file and copy the bin, include, and lib folders into their corresponding directories within your CUDA installation folder (typical located at C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3). Ensure these files are copied, not replaced.

Update system environment variables by modifying the PATH variable in System Properties. Add the following paths:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\extras\CUPTI\lib64
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.3\bin\win64
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.3\common\lib\x64

Verify the installation by running nvcc -V in the command prompt, which should return the CUDA version number.

PyCharm Installation

Download PyCharm Community Edition from JetBrains' website. Run the installer and follow the setup instructions. Choose a custom installation directory if desired, and select all available options. Complete the installation process and launch PyCharm.

PyTorch Configuration

Open Anaconda Prompt and create a new virtual environment using the command:

conda create -n pytorch_env python=3.9

Activate the newly created environment:

conda activate pytorch_env

Configure conda to use mirrors for faster downloads. Add the following channels:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes

Install PyTorch with the following command:

conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3

After installation, test the configuration in Python:

import torch
print(torch.cuda.is_available())
print(torch.backends.cudnn.is_available())
print(torch.version.cuda)
print(torch.backends.cudnn.version())

The output should confirm successful installation of CUDA and cuDNN support.

Tags: Deep Learning cuda pytorch anaconda GPU Acceleration

Posted on Sun, 12 Jul 2026 17:30:20 +0000 by misty