Start Deep learning - Installing Tensorflow in Windows using Anaconda


Deep learning is the hottest area in terms of AI based jobs. The first step you can start today is to get started with Tensorflow which is an open source software library for numerical computation using data flow graphs.

Tensorflow uses the famous python combination with Numpy to enable you to get started in deep learning and create your first neural networks.

Please note : This blog needs intermediate experience in command line, Python and Machine learning. If you are totally new then refer our old blogs in this link to get some ideas.

MieRobot blogs related to Machine learning

Mierobot blogs related to Python.

What is our goal in this blog?

We would be using the Anaconda distribution to install Tensorflow in a windows laptop and then test a simple tensor import from the Jupyter notebook. The blog will now refer tensorflow (all lower as as conda environment we are creating) and Tensorflow(Captital T) as the Library.

Tensorflow uses the famous python combination with Numpy to enable you to get started in deep learning and create your first neural networks

What do you need to have already installed?

A modern computer with 4 GB + RAM and with Anaconda and Jupyter notebook installed for Windows. If you don't these installed then please download from below and install. Without these installations the rest of the steps will not work. We recomend using Python3.5 for this blog. For a quick installation guide on Anaconda over Windows refer the link below of our blog.

Download link for Jupyter Notebook(needs Anaconda)

Download link for Anaconda for Windows

Stop thinking and use Anaconda for all learning

So hold your seat belt and get started? (Get a coffee maybe)

Go to windows command prompt and type 'conda'. If conda is not installed then install it as stated above.

We next need to create a conda environment which can be done as-

conda create -n tensorflow

This would create an environment in your windows machine i.e a Anaconda environment with the name as tensorflow.

This looks as below and will confirm the installations that would be performed.

You would next see the message as - # To activate this environment, use: # > activate tensorflow

Go ahead and type 'activate tensorflow'

Notice that your prompt will now change in (tensorflow) at the start.

Next, we would need to install tensorflow in the conda environment we have just created as:

conda install -c conda-forge tensorflow

It will now prompt you to install the packages and go ahead and type 'Y' which is a yes.

conda install -c conda-forge tensorflow

We are now done with installation of tensorflow. Next, we would need to install ipykernel of a Jupyter notebook as:

conda install ipykernel

OK, if you have reached so far you are all good to register the kernel with the notebook. This can be done as:

python -m ipykernel install --name tensorflow

This will now bind the conda environment with the kernel of Jupyter notebook.

Now run a notebook by- Jupyter notebook

This will open up a session in your default browser at the path you are in as shown in the picture.

You are done with installations of Tensorflow.

So how we test the Tensorflow installations?

Open up a new notebook session and change your kernel to tensorflow. If you have just one kernel you can skip this step.

Now in a notebook window type:

import tensorflow as tf

Press control and enter.

Next : hello = tf.constant('Hello World from Mierobot')

Next : type(hello)

The rest you would see is : tensorflow.python.framework.ops.Tensor

This shows we have the Tensor object.

Finally we print the constant we assigned. To do this we call the Tensorflow session with a variable called as mierobotSess (you can use any variable).

mierobotSess=tf.Session()

print(mierobotSess.run(hello))

If you see the result then bingo! You have installed Tensorflow and all set for our next amazing blogs on deep learning.

References : https://www.tensorflow.org/

#software #employability #engineeringcollege