installing tensorflow on Anaconda

To run tensorflow on anaconda i followed the below steps. i am using anaconda since it has most of the dependencies and libraries pre-installed so we can easily call them when needed.

For this you need to install anaconda and i will not be going through the installation process and configuration of anaconda but will be assuming you guys have done that part.

Step 1

Run anaconda command line with administrator
























Step 2

You would need to run the below command and set the name of your tensorflow environment

conda create -n tensorflow python=3.5



























I have named my tensorflow environment as tensorflow_env. enter y and proceed with the process. If all runs well you would get a result as given below.


done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate tensorflow_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

The above results says that you can both activate the tensorflow environment and deactivate it with the given commands


Step 3

Now lets activate the environment to proceed with the installation






As you can see it is activated now

Step 4

In tensorflow there are 2 versions that we need to keep  in mind. One is the  CPU and the other is the GPU version. At this environment i will be installing the CPU version. So we need to add the below command

pip install --ignore-installed --upgrade tensorflow

If the process is successful you should see a similar out put as given below on your command line




















Step 5

Now we can test if our tensorflow installation is complete. If you go to your anaconda instance you will see the newly created tensorflow environment

























select the newly created tensorflow environment and now lets test if everything works fine. For this i will use vscode.

Open up vscode and create a new python program file. Name it has tensorflowtest.py

And you can try the below code

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
And now hit F5 for debug, if all goes well you should get the below output from the terminal







Comments

Popular posts from this blog

Cognitive Customer Experience

Disrupting Traditional HRM with Ai

CXO Forum 2018 August - The Recent Trends in Artificial Intelligence and the Launch of GIC Chatbot: The first-ever attempt to use Chatbots for providing government information through GIC-1919, as a part of commitments of Open Government Partnership