All the CS5670 projects will be purely python-based. In this tutorial, we will guide you through setting up a python virtual environment called cs5670_python_env on your computer with Anaconda. cs5670_python_env takes care of the dependent python packages for you, and will be used over the semester. Please make sure your code is executable in this environment before submission.

Install Anaconda

Conda is a powerful package manager and environment manager that you use with command line commands at the Anaconda Prompt for Windows, or in a terminal window for macOS or Linux.

Below is how to install Anaconda for Python 3 if you don't have it on your operating system.

Installing on macOS: in step3 enter the command to install Anaconda for Python 3.7

Installing on Linux: in step3 enter the command to install Anaconda for Python 3.7

Installing on Windows

More information about installation can be found via this link.

Set up cs5670_python_env

Once you have Anaconda installed on your computer, you can create cs5670_python_env envrioment from the environment.yml file.

  1. Clone the skeleton code from GitHub Classroom:

  2. Windows: From the Start menu, search for and open "Anaconda Prompt." On Windows, all commands below are typed into the Anaconda Prompt window.

    MacOS: Open Launchpad, then click the terminal icon. On macOS, all commands below are typed into the terminal window.

    Linux: Open a terminal window. On Linux, all commands below are typed into the terminal window.

  3. The file '[root repo]/environment.yml' specifies the dependent packages for this project, and you can create the environment from the environment.yml file:

    conda env create -f environment.yml

Work with cs5670_python_env

In this section, we explain the basic workflow of interacting with cs5670_python_env.

You are now ready to work with the skeleten code. In the future, every time you would like to execute your scripts inside cs5670_python_env, activate it first in the terminal via the following command.

conda activate cs5670_python_env

The command prompt will have a 'cs5670_python_env' saying that you are inside the environment. Launch your python scripts in cs5670_python_env just as how you normally do in the terminal. When you don’t want to use cs5670_python_env, deactivate it,

conda deactivate

More information about anaconda can be found via this link.

Python Code Style

As you know, python is a programming language that heavily depends on indentaion and line endings. To be consistent with the provided skeleton code, make sure to customize your code editor such that python statements are indented by four spaces, and the line ending charater is set to be \n.