In this tutorial, we’ll guide you through the essential steps of building a TensorFlow and a PyTorch working enrivonment on your local machine. For the course we'll be using TensorFlow, but PyTorch is also a very popular framework that you might encounter in the future.

System requirements

Contents

Installation Guide

Note: The process is time-consuming/complex for starters, so please prepare an external power supply if necessary. For reference, an official instruction is here: https://www.tensorflow.org/install/.

Step 1: Anaconda Installation

Anaconda is a data science platform using Python. It also provides a Python package manager that lets you install, update and remove packages.

You can use conda list in the command window to see all the packages you’ve installed.

Step 2: Create Anaconda virtual environment

We are going to create a virtual environment on this Anaconda platform, and install necessary modules. A virtual environment is a named, isolated, working copy of Python that maintains its own files, directories and paths so that you can work with specific versions of libraries or Python itself without affecting other Python projects. Virtual environments make it easy to cleanly separate different projects and avoid problems with different dependencies and version requirements across components. The conda command is the preferred interface for managing installations and virtual environments with the Anaconda Python distribution. (managing conda environments.)

Step 3: Install CUDA and GPU drivers

Compute Unified Device Architecture (CUDA) is a parallel computing platform and programming model created by NVIDIA. It harnesses the full power of graphics processing units (GPUs) for deep learning purposes.

Step 4: Install cuDNN

cuDNN is a GPU-accelerated library for deep learning.

Note 1: This step requires you to create an NVIDIA account.

Note 2: For this step, if you're familiar with PATH environment variable setup, you can follow the official instructions provided after you login with your account. The following is a more understandable way.

Note: If this step goes wrong, you can still install the rest, but when you initiate TensorFlow you will probably see a message: Couldn't open CUDA library cudnn.so.x. The computation speed might be compromised.

Step 5: Install TensorFlow

TensorFlow is an open source deep learning framework created and maintained by Google Brain Team. It is the most popular deep learning framework nowadays.

For windows users:

For Ubuntu users:

Note: Always try to activate your virtual environment.

        >>>import tensorflow as tf
>>>a = tf.constant('Hello TensorFlow!')
>>>with tf.Session() as sess:
...    print(sess.run(a))
# If you see the following output, then you're all set!
b'Hello TensorFlow!'
        
    

Step 6: (Optional) Install PyTorch(Ubuntu and OSX users only)

PyTorch is another deep learning framework for Python. Its predecessor is Torch which relys on Lua. Compared to TensorFlow, Pytorch has its own advantages such as dynamic network design.

To install PyTorch, go to the official website http://pytorch.org/ and follow the install instructions. That’s it!


ECBM E4040 Neural Networks and Deep Learning, 2017.

Columbia University