March 8, 2021 Bella

How to install TensorFlow on Windows?

Last week, we guided you on how to install Tensorflow on Ubuntu OS. But if you are a Tensorflow user on Windows? Don’t worry about that, in this article, let’s see how to install TensorFlow on a Windows machine.

You maybe consider that you should choose either the CPU-only or GPU-supporter version when installing TensorFlow. If you need to design and train simple machine learning models, or if you’re just starting out, I’d recommend you choose the CPU version first. However, it can be slower while performing complex tasks, especially those involving image processing. If you need to use TensorFlow to process a large amount of data, especially in involves images, you should install the GPU-supported version.

To install the GPU-supported TensorFlow, you need to install a number of libraries and drivers. It supports NVIDIA GPU card, with support for CUDA Compute 3.5 or higher.

You must install the following software:

      • NVIDIA GPU drivers
      • CUDA Toolkit: CUDA 9.0.
      • NCCL 2.2 (optional)
      • cuDNN SDK (7.2 or higher)
      • TensorRT for improved latency and throughput.

There are two methods for installing TensorFlow on Windows: pip or anaconda.

1. Install TensorFlow with pip

To get the pip package manager, you need to install Python first. Download the latest version of Python on official Python website and install it.

Once the installation completes, check for the version of pip running on your system by  the command prompt and type:

$ pip3 –version

Now we start to install TensorFlow:

      • Run the Windows command prompt as an administrator. To do so, go to the Start menu, search for “cmd“, right-click it, and choose “Run as administrator“.
      • After that, you need to run one simple command to install TensorFlow:

$ pip3 install –upgrade tensorflow

It will take some time to execute, so remain patient.

      • With pip, you can install TensorFlow with GPU support as follows:

$ pip3 install tensorflow-gpu

Done! Now you can go to section 3 “Verifying the Installation” below to make sure it installed correctly.

2. Installation with Anaconda

First, you can download Anaconda from Anaconda.com then install it.

Once the package is downloaded, double-click it to start the installation. The installer will be verified and a welcome window will pop up:

Click to “Next” button. In the next window, remember to read carefully the terms of the agreement, then click “I agree”.

You will be prompted to choose the installation type. Choose the option you need then click “Next”.

Browse to the directory you want. Then click “Next”.

At this step, you will see the window for “Advanced Options”. Check the second checkbox as below:

Click the “Install” button and the installation process will begin.

Wait till the installation completes, you will get the following message:

Click “Next” and “Finish” in the subsequent windows to complete the installation of Anaconda.

Now you can use “conda“, a package manager used for the management of virtual environments and installation of packages for Anaconda.

Go to the Windows start menu, and type “anaconda prompt“. From the options click “Anaconda Prompt” to launch the prompt as shown in the picture below:

To see details of the conda package, type this command in the prompt:

$ conda info

Now you can create a Python virtual environment with conda. A virtual environment is an isolated working copy of Python, capable of maintaining its own files, paths, and directories so you can work with specific versions of the different Python libraries without affecting the other Python projects.

Execute the conda create command with the following syntax:

$ conda create -n [environment-name]

Next, type “y” for “yes” and press the enter key on your keyboard. The environment will be created successfully.

Then we can activate this environment:

$ activate [environment-name]

Next, run the following command to install TensorFlow:

$ conda install tensorflow

A list of packages to be installed alongside TensorFlow will be shown. Type “y” and then press the enter key to verify the installation of these packages. The progress of the installation process will be shown on the command prompt.

3. Verifying the Installation

Now the TensorFlow has been installed. To verify whether the installation was successful or not, run Python’s import statement and see if you can successfully import the TensorFlow library.

In the previously opened command prompt, which should be using the virtual environment in which you installed TensorFlow, type python to get to the Python terminal:

$ python

Now try to import the library:

import tensorflow as tf

If everything is okay, the command will return nothing other than the Python prompt. However, if the installation was unsuccessful, you will get an error.

Conclusion

TensorFlow is a machine learning framework was developed by Google, used for the development of deep learning models. It comes in two flavors, the CPU-only, and the GPU-supported versions. In which, the GPU-supporter version is more powerful and more suitable for image processing tasks. In this article, we guide you on how to install TensorFlow on a Windows machine using the pip command as well as Anaconda framework.

And, if you are in need of GPU power for your training, we are here for you. iRender brings TensorFlow users in particular and users in the AI / Deep Learning field in general, the cloud computing service with a variety of machine configuration packages from 1 to 6 Nvidia RTX 3090 GPUs on both Windows and Ubuntu operating systems. With simple operations, a friendly interface, affordable cost, 24/7 human support service, and especially free data transmission and environmental storage service, you can completely rest assured to use our service for your tasks.

Let’s get started with us today!

Source: tensorflow.org; stackabuse.com
, , , , , , , , , , , , , , , , , , ,

Bella

Greeting everyone. I work as an Assistant Customer at iRender. I always hope to know more 3D artists and share benefits information with them.
Contact

INTEGRATIONS

Autodesk Maya
Autodesk 3DS Max
Blender
Cinema 4D
Houdini
Daz Studio
Maxwell
Nvidia Iray
Lumion
KeyShot
Unreal Engine
Twinmotion
Redshift
Octane
And many more…

iRENDER TEAM

MONDAY – SUNDAY
Hotline: (+84) 912-785-500
Skype: iRender Support
Email: [email protected]
Address 1: 68 Circular Road #02-01, 049422, Singapore.
Address 2: No.22 Thanh Cong Street, Hanoi, Vietnam.

Contact
[email protected]