How to Download, Install, and Setup Tensorflow on Windows and Linux


TensorFlow is an open-source platform evolved by way of Google for device studying and AI (synthetic intelligence). It is helping with a variety of duties for builders running in that box.

For starters, you wish to have to have an figuring out of device studying or, particularly, deep studying earlier than you’ll be able to employ TensorFlow.

Here, let me spotlight a couple of issues about TensorFlow, its options, and fast strategies to set up it on Windows and Linux.

TensorFlow Overview

Technically, TensorFlow is an open-source platform that is helping with deep studying packages and another device studying use-cases.

It makes issues simple to construct and deploy ML-powered packages. If you wish to have to clear up an issue the use of device studying, you’ll be able to get assist with TensorFlow.

TensorFlow supplies gear to assist increase and teach fashions the use of Python or JavaScript. While I’m now not a developer, you’ll be able to discover its documentation to understand how it impacts your workflow of deploying a device studying utility.

Features of TensorFlow

YouTube video

TensorFlow is known for a number of causes, and you’ll be able to evaluation that for your self, figuring out its perfect function choices.

If we get to speak about the technical advantages, you’re going to have to evaluate them for what you do. So, we will be able to center of attention on commonplace options really useful for many.

1. Open Source

Google made up our minds to open-source TensorFlow in 2015 to permit the neighborhood to reinforce it additional and supply transparency on the way it works.

Developers can customise the library in more than a few techniques to clear up issues you won’t have anticipated.

Without an open-source framework, it won’t had been as in style as it’s. Hence

2. Easy Debugging

TensorFlow objectives to can help you with simple type development; therefore, an easy debugging enjoy is part of that procedure.

The intuitive person enjoy is a cherry on best of it.

3. Supports Both CPUs and GPUs

With TensorFlow, you get the facility to teach the information computation on a CPU or the GPU. Usually, a GPU makes issues quicker for deep studying packages when put next to the CPU.

So, in case you have a formidable GPU to your arsenal, TensorFlow mean you can take advantage of out of it.

4. Useful Machine Learning APIs

APIs assist builders combine quite a few options into their packages. And TensorFlow supplies get entry to to a excellent selection of strong APIs.

Some of them might be offering efficiency benefits as smartly. As consistent with its respectable claims, you will have to now not have an issue with those to be had in Python. If you might be running with different languages, you wish to have to take a look at with the TensorFlow maintainers how excellent they’re to your use case.

5. Ready-Made Models for Production

TensorFlow options quite a few pre-trained fashions. Whether a certified or a amateur, you’ll be able to use the ones to save time and construct ML fashions quicker.

In addition to those options, you get flexibility, ease of use, a visualization toolkit, and extra that may help your device studying building workflow.

Now that you’ve a good suggestion about TensorFlow, the place are you able to obtain it? How to set up it and set it up on your Windows and Linux techniques?

Let us speak about that beneath.

Downloading and Installing TensorFlow

Unlike different methods, you don’t get a .exe setup document right here. Primarily, you’re going to want to obtain the package deal the use of the advisable package deal supervisor.

Overall, there are other ways of set up. We can listing them as follows:

  • Using Miniconda and pip
  • Using Miniconda and pip on WSL 2
  • Using a Docker container
  • Building from assets

How to Install TensorFlow on Windows?

Unlike different methods, you don’t get a .exe setup document right here. You will want to obtain the package deal the use of the advisable package deal supervisor.

#1. Using Miniconda and pip (Recommended Method)

Note: At the time of penning this, TensorFlow 2.10 is the closing model to beef up GPU on Windows (natively). If you’re employed with more recent applications, TensorFlow recommends you put in TensorFlow in WSL 2, which will likely be mentioned subsequent.

If you wish to have to use TensorFlow with GPU beef up, TensorFlow recommends the use of Miniconda (installer for conda package deal supervisor) to kick issues off.

With Miniconda, you get to create a separate surroundings to keep away from struggle with another instrument to your device. 

To get began, you wish to have to obtain the most recent Miniconda Windows Installer and observe the on-screen directions to whole the set up.

Once completed, you wish to have to release the Miniconda urged as proven within the screenshot:

Here’s what it looks as if:

After you spot the Anaconda urged window, you may want to sort within the following command to be certain the conda package deal supervisor has been up to date:

<sturdy>conda replace -n base -c defaults conda</sturdy>

With that out of the way in which, listed below are the stairs you wish to have to observe to set up TensorFlow:

First, to create a brand new surroundings (with the call tf):

<sturdy>conda create --name tf python=3.9 </sturdy>

Tip: You can turn on/deactivate it by way of the use of the instructions: conda turn on tf and conda deactivate

You may have to turn on it to continue additional. To allow GPU beef up within the procedure, you will have to just be sure you have your graphics motive force (NVIDIA GPU) put in, and then set up a couple of applications the use of the next command:

<sturdy>conda set up -c conda-forge cudatoolkit=11.2 cudnn=8.1.0</sturdy>

It downloads about 1 Gigs of applications, which come with gear enabling you to deploy device studying packages with GPU and a deep neural community.

Finally, you’re going to have to make the most of the pip package deal supervisor to set up the TensorFlow package deal. You can select to use conda to set up Tensorflow, however it won’t have the most recent strong model wanted.

Before continuing, be sure that pip has been up to date the use of the command:

pip set up --upgrade pip

Once completed, set up TensorFlow with:

<sturdy>pip set up tensorflow</sturdy>

You will understand a lot of applications being constructed/put in. It may seem as caught within the procedure, however give it a minute, and it will have to resume and whole the set up.

#2. Using Conda and pip on WSL 2

Assuming you have already got WSL 2 setup on your device, you’ll be able to set up TensorFlow the use of the next instructions within the distribution’s terminal:

conda set up -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/

python3 -m pip set up tensorflow

# Verify set up:

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

You can paste it unexpectedly, and it’ll be processed one at a time.

In case you haven’t put in WSL 2 on Windows. Head to the command urged with administrator get entry to, and then sort within the following:

wsl.exe --install

It will have to obtain Ubuntu and allow the WSL function to your device. You will want to reboot your PC for it to whole.

If you can’t in finding Ubuntu on your device, you’ll be able to navigate to the Microsoft Store and set up Ubuntu WSL.

#3. Build From Source

Considering TensorFlow is open-source, you’ll be able to construct it from the bottom up together with your configuration choices.

Hence, that is advisable for complex customers conscious about all of the choices and who know the nuts and bolts to configure. Refer to the official documentation to discover extra about it.

How to Install TensorFlow on Linux?

Like Windows, you’ll be able to set up TensorFlow the use of Miniconda and pip on Linux. Or select to construct from the supply.

Let me display you the way it’s completed:

#1. Using Miniconda and pip (Recommended Method)

Note: Follow the similar instructions as Windows. The best distinction is how you put in/obtain Miniconda on Linux.

Here’s how to set up Miniconda on Linux the use of the terminal:

curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh

bash Miniconda3-latest-Linux-x86_64.sh

Restart the terminal on your Linux distribution to in finding one thing like this:

ubuntu conda

You will understand a (base) earlier than the terminal urged variables. This signifies that conda is these days lively and put in.

Do now not deactivate it except you’re completed with TensorFlow set up.

You can navigate to the stairs discussed above for Windows and get it put in. Or, paste the next to set up TensorFlow:

conda set up -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/

python3 -m pip set up tensorflow

# Verify set up:

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

With Linux, you might have problems with the GPU motive force. For that, you will have to have a look at NVIDIA’s documentation to be informed extra.

#2. Build from Source

Like Windows, development from the supply code is difficult on Linux and purely supposed for complex customers.

You (assuming you’re a novice) will have to now not go for this system except you might have one thing explicit in thoughts. The perfect means to discover extra about it’s to refer to the documentation.

How to Install TensorFlow Using Docker? (Windows and Linux)

Regardless of the platform, Docker permits you to set up TensorFlow pictures with out hiccups.

Make certain you might have Docker put in on your device, or you’ll be able to observe our Docker set up information for assist.

Once completed surroundings it up, you wish to have to input the following command from inside Docker:

docker pull tensorflow/tensorflow  

You want experience with Docker bins to get started a container with the specified configurations to your paintings.

For explicit GPU beef up or downloading a unique TensorFlow model, refer to the choices to be had within the official documentation.

Here’s what the command looks as if when you wish to have to run it the use of Docker:

docker run [-it] [--rm] [-p hostPort:containerPort] tensorflow/tensorflow[:tag] [command]

Conclusion

Installation of TensorFlow is a one-time factor, and with our information, it will have to be a hassle-free procedure for many.

If you already had prior configurations or setup with older Python variations or an older Conda package deal supervisor. Make certain to practice the most recent updates to set up TensorFlow seamlessly.

You may additionally discover the most productive AI Platforms to construct AI and ML packages.

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button