This brief tutorial shows students and new users how to install TensorFlow on Ubuntu 18.04 | 16.04.
For the uninitiated, TensorFlow is an end-to-end open source platform for machine learning built by Google. It has a comprehensive libraries and community resources that allows anyone to build machine learning programs.
When it comes to installing TensorFlow, it can be installed system-wide, in a Python virtual environment, as a Docker container and other others. The most common way to install TensorFlow is via a Python virtual environment where multiple environments can be created and managed easily.
If you’re a student or new user looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS…. It’s a great Linux operating system for beginners and folks looking for easier Linux distribution to use..
Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…
When using Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.…
Both Ubuntu and Windows systems allow you to be productive, easy to use, reliable and enable you to install and run thousands of programs from gaming to productivity suite software for individuals and businesses..
To get started with installing TensorFlow, follow the steps below:
Step 1: Install Python
Since using Python is the most popular way to run TensorFlow, lets go ahead and install Python. By default, Python 3 comes with Ubuntu repositories.
To find out which version of Python is installed on Ubuntu, run the commands below:
That should display similar line as below:
Output: Python 3.6.9
With Python 3.6, you’ll probably want to create a virtual environment using its venv module.
To install the python3-venv package that enables the venv module, run the commands below:
sudo apt update sudo apt install python3-venv
That should enable Python virtual environment.
Step 2: Create TensorFlow Directory
Now that you know the version of Python installed, continue below to create a directory for TensorFlow. To do that, run the commands below:
Next, change into the directory you create and create a Python virtual environment.
cd ~/TensorFlow python3 -m venv venv
After creating Python environment, run the commands below to activate it.
Step 3: Install TensorFlow
Now that your environment is created and activated, use the steps below to install TensorFlow.
To install the current release, which includes support for CUDA-enabled GPU cards (Ubuntu and Windows):
pip install tensorflow
A smaller CPU-only package is also available:
pip install tensorflow-cpu
To update TensorFlow to the latest version, add –upgrade flag to the above commands.
pip install --upgrade pip pip install --upgrade tensorflow
To verify if TensorFlow is installed, you can run the commands below:
python -c 'import tensorflow as tf; print(tf.__version__)'
The command should output the version of TensorFlow installed.
That tells you the version of TensorFlow installed.
Deactivate Python Environment
When you’re done with your Python environment, simply run the commands below to deactivate.
That should delete the Python environment you created to run TensorFlow. For more about how to use TensorFlow, please visit its site to learn more.
That should do it!
This post shows students and new users how to install TensorFlow on Ubuntu 18.04 | 16.04. If you find any errors above, please use the comment form to report them.
You may also like the post below: