Development: Running TensorFlow in Codeanywhere
TensorFlow is the open source machine learning framework provided by Google. When it was first announced in 2015, due to the lack of documentations, it was pretty hard for any beginners (or even veteran software developers) to jump start any development using the framework.
Then early this year (in 2018), Google announced the new documentations with complete sets of video as well as written tutorials and (very importantly) self-testing exercises, which you can test yourself how much you have understood in each chapter of the tutorial. These new sets of documentation is a great help to a lot of developers (including myself), to obtain enough understanding of what are the ideas behind TensorFlow, and to start some actual development using the framework.
This article is going to show you how to set up the development environment for TensorFlow in Codeanywhere. For reference, you can read the official setup procedure from the TensorFlow official web site.
2. The stack includes Python 3, pip and virtualenv (which you will need in later steps)
$ python --version
$ pip --version
$ virtualenv --version
$ virtualenv --system-site-packages -p python3 tensorflow
$ source tensorflow/bin/activate
$ easy_install -U pip
$ python3
2. Create a "Hello World" program
> import tensorflow as tf
> hello = tf.constant('Hello, TensorFlow!')
> sess = tf.Session()
> print(sess.run(hello))
$ deactivate
Anyways, enjoy using Codeanywhere to try out your machine learning development with TensorFlow!!!
Then early this year (in 2018), Google announced the new documentations with complete sets of video as well as written tutorials and (very importantly) self-testing exercises, which you can test yourself how much you have understood in each chapter of the tutorial. These new sets of documentation is a great help to a lot of developers (including myself), to obtain enough understanding of what are the ideas behind TensorFlow, and to start some actual development using the framework.
This article is going to show you how to set up the development environment for TensorFlow in Codeanywhere. For reference, you can read the official setup procedure from the TensorFlow official web site.
Step 1 - Create New Container in Codeanywhere
1. Create a new container with the pre-defined Ubuntu Python Development Stack2. The stack includes Python 3, pip and virtualenv (which you will need in later steps)
Step 2 - Check Main Components
1. Ensure all the main components are properly installed (i.e.: Python, pip, virtualenv)$ python --version
$ pip --version
$ virtualenv --version
Step 3 - Create New Virtual Environment
1. Create a new virtual environment (of Python) with the name "tensorflow"$ virtualenv --system-site-packages -p python3 tensorflow
Step 4 - Activate New Virtual Environment
1. Activate the new virtual environment to start installation for TensorFlow$ source tensorflow/bin/activate
Step 5 - Install PIP
1. Install the latest version of PIP$ easy_install -U pip
Step 6 - Install TensorFlow
1. Install the latest version of TensorFlow
$ pip3 install --upgrade tensorflowStep 7 - Test TensorFlow
1. Activate the Python console$ python3
2. Create a "Hello World" program
> import tensorflow as tf
> hello = tf.constant('Hello, TensorFlow!')
> sess = tf.Session()
> print(sess.run(hello))
Step 8 - Deactivate New Virtual Environment
1. Exit the virtual environment of TensorFlow$ deactivate
Final Notes
The setup for TensorFlow is pretty straightforward in Codeanywhere, comparing to other development environments (such as using Vapor with Swift). One good thing about Codeanywhere is, the free plan allows you to save one created container (or a custom stack in Codeanywhere terms). That means, once you have created the new Python container for TensorFlow, you can save the container for later use, and create another new container for free (say Swift) to work on something else. :)Anyways, enjoy using Codeanywhere to try out your machine learning development with TensorFlow!!!
Comments
Post a Comment