How to expand your machine learning capabilities by installing TensorFlow on Ubuntu Server 20.04

Share on facebook
Share on google
Share on twitter
Share on linkedin
How to expand your machine learning capabilities by installing TensorFlow on Ubuntu Server 20.04

TensorFlow is an open source development platform for machine learning (ML)…

With this software platform, you’ll get a comprehensive collection of tools, libraries, and various resources that allow you to easily build and deploy modern ML-powered applications. Beginners and experts alike can make use of this end-to-end platform, and create ML models to solve real-world problems.

How do you get started? The first thing you must do is get TensorFlow installed on your machine. I’m going to show you how to make that happen on Ubuntu Desktop 20.04.

What you’ll need

  • A running instance of Ubuntu Desktop 20.04 
  • A user with sudo privileges

How to install Python

The first thing to be done is the installation of the necessary dependencies. It just so happens these are all about Python. Log in to your desktop and install the dependencies with the command:

sudo apt-get install python3 python3-venv python3-dev -y

Python should now be installed, so you’re ready to continue on.

How to install TensorFlow

How we install TensorFlow is from within a Python virtual environment. Create a new directory to house the environment with the command:

mkdir ~/tensor

Change into that newly created directory with the command:

cd ~/tensor

Next, create the Python virtual environment with the command:

python3 -m venv venv

Once the above command completes, we must then activate the virtual environment, using the source command like so:

source venv/bin/activate

After you activate the environment, your command prompt should change, such that it begins with (venv) (Figure A).

Figure A

tensor-f.jpg

We’ve activated our virtual Python environment.

Next, we’re going to upgrade Pip with the command:

pip install --upgrade pip

We can now install TensorFlow with the command:

pip install --upgrade tensorflow

TensorFlow should now be installed on your system. To verify, issue the command:

python -c 'import tensorflow as tf; print(tf.__version__)'

The command will return the TensorFlow version number (Figure B).

Figure B

tensor-j.jpg

I’m running the Ubuntu 20.04 desktop on a virtual machine, so GPU is an issue.

Make sure, when you’re done working, that you deactivate the Python virtual environment with the command:

deactivate

And there you have it, you’ve successfully installed TensorFlow on Ubuntu Desktop 20.04 and are ready to start adding machine learning to your builds. 

See Also:
Share on facebook
Share on google
Share on twitter
Share on linkedin

Sign up To our Newsletter:

Keep connected to the latest Technology news and Products
X