How to build an environment for machine learning tools [Windows version]

First of all,

Suppose you use these

  • Python3
    https://www.python.org/downloads/
  • Anaconda
    https://docs.anaconda.com/anaconda/install/
  • CUDA
    https://developer.nvidia.com/cuda-downloads
  • cuDNN
    https://developer.nvidia.com/rdp/cudnn-download
  • TensorFlow
    https://www.tensorflow.org/install

※Precautions

  • If you use other tools, please refer to our other articles
  • Articles on how to build an environment for Python3 and Anaconda are abundant and will be omitted.
  • You will be asked to register as an NVIDIA user in the middle of building the environment, but it is free, so please register

CUDA

1. Open the CUDA download screen

https://developer.nvidia.com/cuda-11-5-0-download-archive

2. Download the installer

Select the following

Windows

x86_64
↓Your WindowsOS version

exe
(local)
image.png

3. Install

Select the installer downloaded in Explorer and install
* You will be asked various questions at the time of installation, but Yes man is fine.
image.png

cuDNN

1. Open the cuDNN download screen

https://developer.nvidia.com/rdp/cudnn-download

2. Download the installer

Check on Agree
image.png

Select Local Installer for Windows (Zip) to download
the installer with a note on the version
image.png

3. Unzip the ZIP file

4. Move the installed cuDNN files to CUDA and install them

Launch File Explorer

Open the CUDA
folderC:Program FilesNVIDIA GPU Computing ToolkitCUDA<Version>
image.png

Open the cuDNN folder
image.png

Move the contents of bin, include, and lib of cuDNN respectively to
the contents of bin, include, libx64 of CUDA, respectively

The contents of each bin, include, and lib of cuDNN are emptied and
each bin of CUDA, each bin of cuDNN is included in the contents of include, libx64 , The state in which the contents of the lib are contained

C:Program FilesNVIDIA GPU Computing ToolkitCUDA<Version>bin C:Program FilesNVIDIA GPU Computing ToolkitCUDA
image.png
<Version>include
image.png
C:Program FilesNVIDIA GPU Computing ToolkitCUDA<Version>libx64
image.png

TensorFlow

1. Launch Anaconda Navigator

image.png
image.png

2. Select Environments

image.png

3. Click Create in the bottom left

image.png

4. Build a virtual environment for TensorFlow

* We will make both CPU version and GPU version.

For CPU version

Enter tf-cpu in Name and create

GPU version

Enter tf-gpu in Name and create

image.png

5. Install TensorFlow in each environment

* Install both CPU and GPU versions.

For CPU version

Select the created environment tf-cpu and press
image.png
Open terminal ↓

$ pip install tensorflow


Confirm. If it looks like this, it is a success

$ python
↓
>>
↓
>> import tensorflow
↓
>>

GPU version

Select the created environment tf-gpu and press
image.png
Open terminal ↓

$ pip install tensorflow-gpu


Confirm. If it looks like this, it is a success

$ python
↓
>>
↓
>> import tensorflow
↓
>>

This concludes the construction of the environment.