How to Install and Setup TensorFlow Virtual Environment platform.
image source<datasciencelearner.com>

How to Install and Setup TensorFlow Virtual Environment platform

Python virtual environments are used to isolate package installation from the host system. This is done to avoid the Installed packages or libraries within a virtual environment not to conflict with the host or the local system setup. This means that each project can have its own dependencies, regardless of what dependencies every other project would have. So, in this wise, your tensorflow project would have a separate working environment from other project you might create.

You must also make sure that TensorFlow has the version of Python that it is compatible with. The best way to accomplish this is with an Anaconda environment. Besides, you can create different python virtual environment for different projects as well.

Now, having known this, let’s get started:➡

Python 3.5–3.8
Python 3.8 support requires TensorFlow 2.2 or later.
pip 19.0 or later (requires manylinux2010 support)

Ubuntu 16.04 or later (64-bit)
macOS 10.12.6 (Sierra) or later (64-bit) (no GPU support)
Windows 7 or later (64-bit)

Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019
Raspbian 9.0 or later
GPU support requires a CUDA®-enabled card (Ubuntu and Windows)
Note: Installing TensorFlow 2 requires a newer version of pip.


Starting with TensorFlow 1.6, binaries use AVX instructions which may not run on older CPUs.
Read the GPU support guide to set up a CUDA®-enabled GPU card on Ubuntu or Windows.

Incase you’re confuse with CPU vs GPU in Machine Learning follow this URL

  1. Install the Python development environment on your system
    Check if your Python environment is already configured:

Note: TensorFlow Requires Python 3.5–3.8, pip and venv >= 19.0

Run the following code to check your pip and python version

If these packages are already installed, skip to the next step.
Otherwise, install Python: here and make sure that you have anaconda installed on your machine click here to install

Having done this, install inbuilt IDE in the anaconda environment which would be used for this tutorial

2. Create a virtual environment (recommended)

Like I said earlier, each environment that you create can have its own Python version, drivers, and Python libraries. I suggest that you create an environment to hold the Python instance for your project.
Use the following command to create your environment. I am calling my environment , you can name yours whatever you like.

# show packages installed within the virtual environment
pip list

“””add new or additional packages/ libraries to your environment such as matplotlib and requestHtml which was not part of my virtual packages when i was doing this. Just do this to avoid any difficult task.
You can ignore this as these might be added automatically in virtual environment as we progress with the steps, but should incase you get any , come back and do this.
“””

#do a to check your updates
deactivate # don’t exit until you’re done using TensorFlow

3. Installing TensorFlow : CPU | GPU

The following command installs TensorFlow for CPU support. Even if you have a GPU, it will not be used.


The following command installs TensorFlow for GPU support. All of the complex driver installations should be handled by this command.

#Install and upgrade tensorflow package dependencies inside your virtual environment

#verify the installation

4.Register your Environment
The following command registers your tensorflow virtual environment in jupyter kernel.
And make sure, you do “conda activate” in your new tensorflow environment.

5.Testing your Environment✔
You can now start Jupyter notebook. Use the following command.

👏👏👏👏👏

🙌
References
TensorFlow official website Installation guide [https://www.tensorflow.org/install]

Instructor: Jeff Heaton, McKelvey School of Engineering, Washington University in St. Louis
Applications of Deep Neural Networks → Software Installation

For more information visit the class website.[https://sites.wustl.edu/jeffheaton/t81-558/]

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store