Now Reading
How To Set Up The AI Development Environment For The First Time With Tensorflow

How To Set Up The AI Development Environment For The First Time With Tensorflow

Building algorithmic agents with neural networks is the go-to business strategy in the current technology environment. Now, Google’s Tensorflow library helps developers build these agents with pre-defined functions for easy implementations of various tasks. In this article, we shall be going through the steps to setup an environment for development of these models with Tensorflow library. Setting up an environment for these tasks is mandatory because each model you build is unique to one another and have different dependencies.

Deep Learning DevCon 2021 | 23-24th Sep | Register>>

Install Python

As part of the first step, one should download Python. Tensorflow is available on both Python 2 and Python 3. You can download it from here. Once you have downloaded the desired version, you have to set up the environment variables.

You can access the environment variables by either typing it Start menu (Win 8 and Win 10). Or you can go here:

My Computer > Properties > Advanced System Settings > Environment Variables>

Follow us on Google News>>

You have to add the path of your python. If it is a default Windows installation, the default path will be C:/Python36 for Python 3. If everything has been setup correctly, you can test it by typing python in the command prompt. The output should be as follows:

Setup Virtual Environment

PIP is a installer package for Python which stands for Python Installer Package. If one faces problems with Pip, it is accessible here.

Download get-pip.py, be careful to save it as a .py file rather than .txt. One you are in the directory where the file is downloaded, on command prompt run,

python get-pip.py

Once pip is set, we shall setup the virtual environment with virenv available for Python.

pip install virtualenv


Now make a directory for your virtual environment, let us call it tensorflow_test. And make an environment called “development” and access it.

You have to navigate to the Scripts folder and run the activate command to activate the environment. Here’s how it is done:

Install Tensorflow (CPU/GPU)

Once you have setup all these, you can now install the Tensorflow library. It is as simple as installing the virtualenv. Depending on which version you desire, Tensorflow has a GPU extension which can be accessed by having CUDA and cuDNN installed.

CPU Version:

Once you have the environment set for the installation of Tensorflow, you can run the following command to install the CPU version of Tensorflow. If everything is setup right, the packager will download and install all the dependencies required for Tensorflow and eventually the CPU version.

GPU Version:

If you need the GPU extension of Tensorflow for better computational speed and performance of your system, then you need to install the CUDA and cuDNN from the Nvidia.

Note: Tensorflow currently supports Nvidia GPU cards only.

CUDA toolkit can be downloaded here, and it is similar to setting up the path in the environment during the Python installation, one has to follow the same steps to setup the CUDA toolkit.

Also, cuDNN has to be setup and can be downloaded from here.

Based on our experience, we had to downgrade the CUDA installation to 9.0 version and cuDNN to version 7.0 since there were a few problems with the newer versions of CUDA and cuDNN. Hope this has been resolved and updated. Once everything has been setup, the following code will run smoothly.

Once we have reached this stage, it is time to test if Tensorflow is working or not. We can start by importing it on Python.


It works like a charm and finally we have setup the environment and you can start playing around with neural nets now. Also, you can install Jupyter Notebook inside the environment if you are a notebook person. This will open in a new browser window and its easy to install with the following code

pip install jupyter

Conclusion

With these steps one can easily setup the environment required Tensorflow computations. Also, with the GPU extension, the models run exceptionally faster compared to running them on CPUs.

What Do You Think?

Join Our Discord Server. Be part of an engaging online community. Join Here.


Subscribe to our Newsletter

Get the latest updates and relevant offers by sharing your email.

Copyright Analytics India Magazine Pvt Ltd

Scroll To Top