Installing Tensorflow on Windows Subsystem Linux (WSL)

According to Wikipedia, “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.” Installing Tensorflow on Windows Subsystem Linux is simple as installing on Ubuntu.

Tensorflow works well on Ubuntu and Windows 10 provided us Bash on Ubuntu as a subsystem. I tried to install Tensorflow on Windows 10 itself and WSL as well. Tensorflow in Bash on Ubuntu working well with CPU only. For Tensorflow GPU, Microsoft team already working to enhance GPU integration with WSL.

Let’s begin without wasting more time, how to install Tensorflow on WSL.

Installing tensorflow on WSL

Prerequisite: Python and Pip:

Python is automatically installed on Windows Subsystem Linux. Take a moment to confirm (by issuing a python -V command) that one of the following Python versions is already installed on your system:

  • Python 2.7
  • Python 3.4+

Now you need to install Pip. You can install Pip or pip3 as per your choice. To install pip you can use following commands.

Installing Tensorflow on Windows Subsystem Linux (WSL)

Assuming all the prerequisite tools is installed on your WSL, Now take following steps:

Install TensorFlow by invoking one of the following commands:

(Optional.) If Step 1 failed, install the latest version of TensorFlow by issuing a command of the following format:

Now you have installed Tensorflow CPU on your WSL. Unfortunately WSL still not supports Tensorflow GPU version.

To verify your Tensorflow installation do a sample run.

Run a short TensorFlow program

Invoke python from your shell as follows:

Enter the following short program inside the python interactive shell:

If the WSL outputs the following, then you are ready to begin writing TensorFlow programs:

For more about Tensorflow installation, you can visit the official site:

In WSL when you run any Tensorflow program, you will get a warning:

To disable this warning you can follow mentioned steps:

Run below mention command on Windows Bash shell:

Or you can add a below-mentioned snippet to your Tensorflow Program:

Please keep in mind till this day, Windows subsystem Linux does not support Tensorflow-GPU. Hopefully, Microsoft Team will add this feature to WSL soon.

Check out more Interesting topics here:

I’m Dipendra, software developer, and designer who has written code in many of the language known to mankind.Passionate about Technology. In my free time, I love to write articles and build the code.

5 comments On Installing Tensorflow on Windows Subsystem Linux (WSL)

Leave a reply:

Your email address will not be published.

Site Footer