Hire me on Fiverr! for Professional Google Cloud Services, WordPress Website Development, Security Setup, Website Migration.

How to Install Tensorflow on Ubuntu 18.04 in Google Cloud. TensorFlow is open-source machine learning software developed by Google which is used to train neural networks.

In this tutorial, we’ll install TensorFlow’s “CPU support only” version. This installation is ideal for people looking to install TensorFlow, but who don’t have Nvidia graphics card.

Prerequisites

Setting Up Python 3

Ubuntu 18.04 ships with both Python 3 and Python 2 pre-installed. To make sure all packages are up-to-date, start by updating the system.

SSH to your Compute Engine instance and begin to execute the following commands.

sudo apt update
sudo apt -y upgrade

Once the update and upgrade is complete verify the Python installation using the following command.

python3 -V
Output
Python 3.6.7

Install the Required Packages

sudo apt install python3-pip python3-dev

Once Python is set up, and pip and other tools are installed, we can set up a virtual environment to install Tensorflow.

Setting Up a Virtual Environment

We will be using the virtualenv module here, which is part of the standard Python 3 library.

sudo -H pip3 install virtualenv
mkdir ~/myproject
cd ~/myproject
virtualenv tf-env

Activate the virtual environment by typing.

source tf-env/bin/activate

Your prompt should change to indicate that you are now operating within a Python virtual environment. It will look something like this: (tf-env) username@host:~/myproject$

Install Tensorflow

With your virtual environment activated you can install Tensorflow.

pip install --upgrade tensorflow

Once the installation is completed you can verify the installation using the following command.

python -c 'import tensorflow as tf; print(tf.version)'
Output
1.13.1

Conclusion

Now you have learned how to install Tensorflow on Ubuntu 18.04 on Google Cloud Platform.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Please help us get 1000 likes in Facebook!
LIKE NOW

JOIN OUR NEWSLETTER

Sign up with your email address to receive tips and updates
SUBSCRIBE NOW
Terms and Conditions apply
close-link
Click Me