Stealing pages from the server...

TensorFlow 2.0 Installation


TensorFlow makes people love and hate. It is an end-to-end open source platform for Machine Learning and Deep Learning. However, I always have trouble with installing TensorFlow a bunch of times. Thus I decide to share my experience in order to help others to solve this same problem.

Set up Conda Environment

Conda is a package and environment management tool that allows you to install Python packages on your computer as well as create and manage multiple Python environments, each containing different packages.

  1. Install Python from its official website.
  2. Install Anaconda 3 for win10.
  3. Open command line. (Windows Key + R and type in CMD)
  4. Create a virtual environment and change the ENV_NAME of an ipython kernel.
conda update conda
conda create --name ENV_NAME python=3.7.3
conda activate ENV_NAME 
conda install ipykernel -y
python -m ipykernel install --user --name ENV_NAME --display-name "ENV_NAME"

CUDA and cuDNN

If you intend to utilise GPU to speed up your computation, it is neccessary to install CUDA and cuDNN. This link is the overview of the compatible versions for Tensorflow. Please download the list below first.

  • NVIDIA® GPU drivers: link
  • CUDA® Toolkit: link
  • cuDNN SDK (Unzip to C:\tools\cuda): link
  • (Optional) TensorRT 5.0: link

After installing particular CUDA/cuDNN combination, we have to set environment variable.

System Properties

On the Environment Variables dialog, you’ll see two sets of variables: one for user variables and the other for system variables. Just choose the upper one to edit. Next, on the Edit environment variable dialog, you’ll see a list of all the paths that are currently in the PATH variable. Add the following to PATH variable.

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\extras\CUPTI\libx64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include
C:\tools\cuda\bin

There is a shorcut to add PATH variable more efficiently. That is, by adding it via command line. Use Windows Key + R to quickly launch Apps as administrator, and type in CMD. After opening command line, input the following code.

SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;%PATH%
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\lib64;%PATH%
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;%PATH%
SET PATH=C:\tools\cuda\bin;%PATH%

Final Step

This is the final step. In command line just type in pip install tensorflow and it is done. Congratulations!

Hope everyone enjoy Tensorflow!


Author: Yang Wang
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Yang Wang !
 Previous
Integrate Atom with Cmder Integrate Atom with Cmder
In this blog, I'll be sharing with you my programming setup for Atom and Cmder, and talking about the most useful tips in it.
2020-12-15
Next 
EDA for Predicting Insurance Claim EDA for Predicting Insurance Claim
Exploratory Data Analysis (EDA) is understanding the data sets by summarizing their main characteristics often plotting them visually. This step is very important especially when we arrive at modeling the data in order to apply Machine learning. In this article, I'll show you how I did for this!
2020-11-27
  TOC