Jimce
3 min readApr 26, 2021

--

Tensorflow+Tensorlfow_gpu environment install in Windows 10

What is tf2.x and tf1.x different??

compare GPU and CPU package:
tf2.x is in the same package
tf1.x will need to install them separately

I will create the environment like list below step by step

tensorflow=2.3.0
cuda =10.1
cudnn =7.6

my system info:
GPU:GEFORCE 940MX
OS:windows10(x64)

Step 1.google type in “GPU model+SPECIFICATIONS”,check in the GPU official website if it support CUDA.

yes!!it’s supported

Step 2. Check tensorflow_gpu version

https://www.tensorflow.org/install/source_windows

I will build the environment by this one list

Step 3.

Check OS version

it’s windows 10 (x64)

Step 4.

Install CUDA and set up environment

(1.)Install CUDA ,download from below

https://developer.nvidia.com/cuda-toolkit-archive

customized installation only for cuda package

(2.) Cudnn to replace CUDA file,download from below

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

check the version you need in system
unzip cudnn file

(3.) go to CUDA path to replace file with cudnn

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1

replace your cuda file by cudnn file

(4.)set up the system environment variables

go to search type

Edit the system environment variables

Ahead to environment variables

edit “system variables”->“Path”

then add two lines below:

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

afterwards open anaconda’s terminal (in any environment) type :
nvcc -V

succeed activate GPU driver message

Step 5.Create virtual environment in ANACONDA

(1). install anaconda

https://www.anaconda.com/products/individual

(2.)Create TENSORFLOW environment name “MaskRCNN” with python version 3.7 in terminal

conda create -n MaskRCNN pip python=3.7

(3.) Activate the environment

activate MaskRCNN

(4.) install tensorflow

Program excecute by CPU

pip install tensorflow==2.1.0

check if tensorflow is installed

pip show tensorflow

(5.) double the environment all correct

pip list

(6.)tensorflow_gpu check and test

check if tensorflow_gpu is installed

test if tensorflow_gpu is working

python
from tensorflow.python.client import device_lib print(device_lib.list_local_devices())
it should be no error or warning respond

--

--