Environment Setup

All the assignments in this class will be located on the class repo here. In order to prevent development/grading issues with code running differently on everyone's computer, we will use a common Python version (3.6). You can also follow instructions on how to use pyenv & pipenv to manage our python version and package dependencies. We will also customize the options for Keras. Follow the instructions below to set everything you need for the class and feel free to post on the Piazza if you have any questions regarding them.

Instructions

Class Starter Code

To get the class starter code, clone the class repo on your machine:

$ git clone https://github.com/UMD-CS-STICs/389Aspring18.git

All the code for the practicals will be located in the projects folder.

Every week when new practicals or changes are updated, run the following in the directory to get the latest code:

$ git pull

Please make sure that you keep all solutions to the practicals private. The same academic violations apply for this course as any other CMSC course. You are welcome to ask questions regarding the project on Piazza however or discuss ideas with classmates.

Python (manual installation)

Most computers come with Python 2.x but we will be using the latest version (Python 3) for this course. You can check what version of python you have by running:

$ python3 -v

If it says 3.6.x, where x can be any number, you are good to go. Otherwise if it throws an error, follow the instructions below.

Note: $ python starts a Python 2 environment while python3 starts a Python 3 environment so make sure you use $ python3 when running your code.

For macOS make sure you have brew installed and run:

$ brew install python3

For Linux, follow the instructions here.

For Windows, download and run the installer from here. Make sure you select the "Add Python 3.6 to PATH" option on the first screen.

Pip (with requirements.txt)

This method is easy to use but won't always gaurantee that your code runs the same as the original machine it was developed on or other students. Simply run the following command in your project directory to install all the package requirements:

$ pip install -r requirements.txt

Python (with pyenv)

Note: Make sure you have curl and git installed on your machine (although they probably are).

Install pyenv by running:

$ curl -sL https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

Next, add the following lines to your ~/.bashrc:

Note: that on MacOS, you should edit ~/.bash_profile instead as Terminal opens a login shell by default)

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

To update pyenv, run:

$ pyenv update

To test if your installation is working, quit the terminal (or source ~/.bashrc) and run:

$ pyenv versions

Now, let's install the Python version (3.6.3) we will use in class:

$ pyenv install 3.6.3
$ pyenv global 3.6.3

Note: Whenever you run Python, it will now use this version as the default. However, you can also set a directory-local version by running $ pyenv local <python version>.

If you have any build issues check out the pyenv build wiki here.

Pip (with pipenv)

This is a little harder to setup and use but will ensure that your code runs correctly.

If installing pipenv on macOS, run:

$ brew install pipenv

Else, run:

$ pip install pipenv

Now whenever you are in the project directory, run the following command to setup your environment:

$ pipenv install

To activate the environment when working on your project, run:

$ pipenv shell

At anytime you can run the following command to exit the pipenv shell:

$ exit

The Pipfile located in the project directory will contain all the dependencies required for the project code.

Keras Setup

Follow these instructions to setup Keras options for our course. Make sure the keras.json preferences file exists by importing Keras:

$ python
import keras
quit()

The keras.json file is usually located in the home directory (~/). Next, edit the keras.json option values to look like this in an editor of your choice (nano, vim, sublime, etc.):

{
    "image_dim_ordering": "tf", 
    "epsilon": 1e-07, 
    "floatx": "float32", 
    "backend": "tensorflow"
}

By setting these parameters, Keras will use Tensorflow as the default backend which is important for dimension orderings later on.

Thanks to the writers of this and this for much of this setup guide.

results matching ""

    No results matching ""