A full set of configuration deep learning environment under win10: anaconda3 + cuda10 2 + Cudnn + Pytorch1. 6 + pychar (detailed tutorial, pro test available)

Posted by kindoman on Sat, 15 Jan 2022 00:11:19 +0100

Random talk about Autonomous vehicle_ 02

I ReadMe

  1. This paper aims to build a usable and pollution-free deep learning environment for children who are equipped with GPU in the computer and have deep learning needs.
  2. The article is based on the various methods of the great gods on the Internet, and then synthesized by myself. If there are similarities, it is a pure accident.

II Step 1: install Anaconda

  1. Download the installation package according to your computer: Link here.
  2. After downloading, unzip the installation package and complete it step by step according to the instructions.
  3. Verify that the installation was successful and create a virtual environment for subsequent configuration.
# Check whether the installation is successful: (input at cmd terminal)
conda --version
# Create virtual environment: (input at cmd terminal)
conda create -n Pytorch_GPU python=3.7

III Step 2: install cuda10 two

  1. Download cuda10 2: Link here . (it is recommended to download exe(local) version) Note: if you previously downloaded other versions of CUDA, you can delete other versions. Please move to the following steps for specific methods: Link here
  2. When the download is complete, double-click exe file, enter the installation phase

Choose ok here

Select custom installation here

Uncheck the part as shown in the figure
It is installed in drive C by default. It is best not to change the address casually

Wait for the installation to succeed

There is no need to configure the environment. Just check whether CUDA is installed successfully

# Enter at cmd terminal:
nvcc -V
# If you are prompted with the following information, the installation is successful:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:32:27_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.2, V10.2.89

IV Step 3: install Cudnn and configure the system environment variables

  1. Download the Cudnn installation package (you need to register), Link here
  2. After registration, do not download the latest version, download the stable version v7 6.5:

Find stable version


After downloading and decompressing, you will get a directory named CUDA. Copy the contents of bin,include and lib directories to the installation directory of CUDA (default: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2). The final results are as follows:

Configure system environment variables
This computer -- > properties -- > advanced system settings -- > Advanced -- > environment variables
Click Path in the user variable, click new, and enter:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64

After input, confirm, confirm and confirm. Then check whether the installation is successful:

# Input in sequence at the terminal
cd C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\extras\demo_suite
bandwidthTest.exe  # Display Result = Pass
deviceQuery.exe  # Display Result = Pass

V Step 4: install PyTorch

  1. Activate and enter the virtual environment prepared in advance in step 1
activate Pytorch_GPU
  1. pip download and install pytoch
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
  1. After the download and installation is completed, check the installation results, and enter the following instructions in sequence at the current terminal. The result is that the installation is successful, as shown in the figure (the virtual environment named by the blogger here is Pytorch2, so it will be slightly different)
import torch

Vi Step 5: configure pytoch to the project in pychart

  1. File -> Settings
  2. Project Interpreter -> Show All...
  3. If there is no Python environment just configured in Show All... We need to configure it ourselves

  4. After selecting, click ok continuously until the end.
  5. After a moment, complete the configuration and check whether the configuration is successful in the lower right corner of pychart as shown in the figure below

To sum up, complete the full set of configuration.

VII experience

  1. Pay attention to the matching between various software versions.
  2. The latest version of CUDA seems to no longer need to configure Cudnn for acceleration.
  3. A good environment configuration is more than half of success. It is difficult to finish at the beginning. Don't give up easily.

VIII Article reference:

  1. Windows system cuda10 2 + cudnn installation tutorial
  2. Win10 operating system: PyTorch virtual environment configuration + PyCharm configuration
  3. 2020.08 latest must see pytorch + cuda10 2 (or 10.1) + Python 3 The installation of version 7 is completed in 30min (five hours of blood and tears experience). The personal test is available!! Pit prevention!!

If you have any questions, please correct them. Reprint is welcome, but please indicate the source.

Topics: Anaconda Pycharm Pytorch CUDA cudnn