Local Platform Setup

This guide describes the steps to follow to install the virtual environment to run locally on your machine.

Anaconda

Anaconda is the leading open data science platform powered by python or . The open source version of Anaconda is a high performance distribution of Python and you’ll have access to over 720 packages that can easily be installed with conda.

To install Anaconda, please click the link and choose the appropriate operating system installer and Python 3.7 version (recommended) to download: ​ ​ https://www.anaconda.com/distribution/

● With the Graphical Installer, just follow the instruction to finish installation. ​ ​

● If you download the MacOS or Linux Command Line Installer, open your terminal and go to ​ ​ directory that contains the Installer and run the sh file like the following ​ ​

./Anaconda-v-0.x.y.sh ​

Permissions: If you couldn’t run this file, you can right click that file and choose the Properties, ​ in the Permission tab, please make sure the file is allowed to execute, OR you run the following command to change access permission via command line: ​ chmod +x Anaconda-v-0.x.y.sh

Create a Virtual Environment

Once the Anaconda is installed, the next step is to create a Python virtual environment. A virtual environment is a real good way to keep the dependencies required by different projects in separate places. Basically, it solves the “Project X depends on version 1.x but, Project Y needs ​ 4.x” dilemma, and keeps your global site-packages directory clean and manageable. For example, you can work on a project which requires matplotlib 1.5.3 while also maintaining a project which requires matplotlib 1.4.2.

For Mac OS and Linux users, you can simply open the terminal (Windows User can open the Anaconda Prompt), and type the following: conda create -n envname

Where envname is just a name of your virtual environment. If you want to pass a specific ​ ​ python version, you can do: conda create -n envname python=3.7

Once the environment is created you may activate it by typing: conda activate envname

To deactivate it, simply: conda deactivate envname

Tensorflow

The next component to install is Tensorflow. There are two packages that could be installed: tensorflow (Current release for CPU-only and recommended for beginners) ​ ​ ​ tensorflow-gpu (Current release with GPU support (Ubuntu and Windows only)) ​ ​ ​

The tensorflow-gpu has hardware requirements and software requirements, I will ​ ​ recommend you to check the following link before you install it. https://www.tensorflow.org/install/gpu

For the initial installation, it is recommended to install the CPU-only tensorflow package since you may encounter a lot of issues if you haven’t satisfy those requirements. If you are interested in using tensorflow-gpu and have problems, feel free to ask us.

In the virtual environment, type the following to install Tensorflow: conda install tensorflow

(Note: you can also use to install the tensorflow but i will recommend conda since its performance actually is better than pip)

Once the installation is done, in the command line, type the following to verify: python -c "import tensorflow as tf; tf.enable_eager_execution(); ​ print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

If there is no error, tensorflow is correctly installed.

Jupyter notebook

For most of materials in this course we will use Jupyter notebooks to run our code. Jupyter ​ Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Although Jupyter notebook is ​ included in Anaconda, we need to install it inside the virtual environment: conda activate envname pip install jupyter notebook

To start Jupyter notebook server, type following in terminal (still in the same virtual environment you have created): jupyter notebook

And your browser will pop up the jupyter notebook dashboard like the following,

you can create a new ipynb file, and try importing tensorflow to make sure Tensorflow can be used in your Jupyter notebook. Type the following in the cell and press Shift + Enter to run the cell: import tensorflow as tf

If there is no error,then congratulations you are ready for the Tensorflow l!!

If you still have other issues, feel free to contact us.