Home Linux How To Install and Use TensorFlow on Ubuntu

How To Install and Use TensorFlow on Ubuntu

In this guide, I will show you How To Install TensorFlow on Ubuntu ( Step-by-Step) process. If you are starting to get interested in Machine Learning and AI you might want to know how to use TensorFlow because it’s a tool you will use in your daily routine.

Artificial Intelligence (AI) is everywhere and it’s possible is that you are using it in one way or the other and you don’t even know about it.

Some of the popular applications of AI is Machine Learning (ML) used in Face Recognition, Email Spam and Malware Filtering, Online Customer Support, Product Recommendations, Online Fraud Detection, Videos Surveillance, Virtual Personal Assistants such as Siri, Alexa, Google.

TensorFlow is an open-source software library for dataflow programming across a range of tasks. It is a symbolic math library, and is also used for machine learning applications such as neural networks.

It is used for both research and production at Google, ‍ often replacing its closed-source predecessor, DistBelief.

Getting Started with TensorFlow and Deep Learning | SciPy 2018 Tutorial | Josh Gordon

We will TensorFlow install using conda with the Anaconda Python distribution. There are many different versions of TensorFlow, and many different ways to install it.

For this tutorial, we will be installing TensorFlow with CPU Support on Ubuntu 16.04  and Python 3.6 but it is the same process for Ubuntu 18.04.

To check the Python version, use the command in the terminal:

python –version

Note:- I have written a post for people looking for What Is The Best Python Version?, do read it If you are interested.

install tensorflow on ubuntu

Step-by-Step Process To Install TensorFlow on Ubuntu

Step1:- We must first install Anaconda.

Relate to this article on how to install Anaconda on Ubuntu

Step 2:– Let’s start by creating our virtual environment on which we will install tensorflow. Open the Terminal and enter the following command $ conda create -n TFENv.

install tensorflow on ubuntu

Related Post Top 13 Best laptop For Machine Learning

Step 3:- Once you have created the virtual environment you have to activate it be running the following command $ source activate TFENv

install tensorflow on ubuntu

Step 4:- Now that we have our environment created and activated we can now install tensorflow.

To install tensorflow we run the following command in the terminal pip install –upgrade tensorflow

install tensorflow on ubuntu

When you run that command the installation of tensorflow will being. Note that the installation will install all missing dependency packages.

Note:- I have written a post for people looking for the best laptop for machine learning, do read it If you are interested.

install tensorflow on ubuntu

Step 5:- Now that we have tensorflow and all its dependencies installed let’s try to import it to make sure it’s working properly.

Start python in terminal with the following command Python. Next import tensorflow by entering Import tensorflow. If everything goes well you should be able go to the next line without any error message.

install tensorflow on ubuntu

Let’s write a simple hello word program to test our installation. If the below code generates the result Hello World it mean our TensorFlow is working.

Import tensorflow as tf

Hello = tf.constant(‘Hello World’)

S = tf.Session()

print(s.run(Hello))

install tensorflow on ubuntu

Install TensorFlow in Jupyter Notebook | How to Install TensorFlow on Ubuntu | Anaconda |Simplilearn

Conclusion

Tensorflow is becoming the most popular machine learning framework available. If you want to start learning machine learning then Tensorflow is one of the best framework you could choose.

TensorFlow is used to solve complex problems like Image Classification, Object Recognition, Sound Recognition, etc. With tensorflow you can easily export you models for Android and iOS devices and IOT devices such the Raspberry Pi.