System Setup

— Alex Reinhart and Christopher Genovese

It’ll be easiest if everyone in the class has a similar setup for Git, Python, R, their class repositories, and so on, so we can provide instructions that apply to everyone. These instructions will get you set up and running. You should only need to do this once per computer you use.

First, a few steps:

  1. Install R if you do not already have it.
  2. Install RStudio Desktop (the free version) if you do not already have it.
  3. Install Anaconda if you have not done so before. This includes Python and makes it easy to install many packages that have complicated requirements. Choose the Python 3 version.
    • The installer will ask if you want to install Visual Studio Code. If you don’t already have a preferred text editor, answer yes. VS Code is free and works well with R, Python, and many other languages.
    • Visual Studio Code has extensions for many languages. We recommend installing the Python extension and this R extension.
  4. Install Git if you haven’t done so before.
    • On Windows, the installer will ask lots of questions. The defaults are all fine. Be sure it selects the option to use Visual Studio Code as Git’s default editor.
  5. Register for a GitHub account if you do not have one. You may use any username you prefer; we will later ask for your username so we can keep track.
  6. Follow the link, sent to you in a Canvas announcement, to get a GitHub repository for your homework assignments.

Next, follow the instructions below corresponding to your operating system.

Windows Pre-Setup #

First, Windows users using Anaconda need to configure Git Bash so it can run Python. Open the “Anaconda Prompt” program and run this command:

conda init bash

It may complain “Operation failed”, but as long as you see modified next to the listing ending in .bash_profile, it should be fine.

Next, open Visual Studio Code (if you’re using it). Use the gear icon in the lower left to open the Settings page, then use the icon in the top right labeled “Open Settings (JSON)” to open settings.json. Make settings.json look exactly like this:

  "": "C:\\Program Files\\Git\\bin\\bash.exe",
  "": ["--login"],
  "": "C:\\Program Files\\R\\R-3.6.1\\bin\\x64\\R.exe"

(Make sure the version in, 3.6.1 in this case, matches the version number of R you installed. If you don’t know the version, open R Studio. The first thing it shows in the console is the text “R version…” with the number.)

Save the file. Next, open the Terminal menu on the top and select New Terminal. We’ll use this terminal to run the following commands.

For those of you not using Visual Studio Code, you should open Git Bash to run the following commands.

Next, run

cd ~
curl | python -

You should see a message that it “Successfully installed settings” to a file. Before proceeding, type exit in the terminal, hit Enter, and then open a new terminal. The settings will not take effect until you open a new terminal.

The script does a few things: it sets up Python and R to work correctly on Windows under Git Bash, adds R to the PATH so Git Bash can find it, and sets your home directory to be C:/Users/yourusername/Documents.

Next, skip to the section below about configuring Git.

Mac and Linux Pre-Setup #

Mac and Linux users should be able to run Python and R from the command line with no extra setup, once they are installed. You should verify that they run correctly by opening a terminal and running these commands:

R --version
python --version

(You can use the terminal inside Visual Studio Code, use the Terminal app included with macOS, or use your favorite Linux terminal program.)

These commands should print out the versions of R and Python you have installed. Make sure you installed Python 3, not 2, preferably Python 3.5 or higher.

Mac users using Visual Studio Code: Follow these instructions so the code command works from the command line (e.g. so Git can use it to edit commit messages).

Now continue with the instructions below.

Set Your Git Config #

When Git records commit messages, it records them with your name and email address so that when you collaborate with others, they know who made which commits. You need to tell Git your name and email before you use it. In a terminal, run the commands:

git config --global "Your Name"
git config --global ""

If you use the email address you used on GitHub, then GitHub will automatically link your commits to your account.

On your computer, you have default programs: programs that the operating system knows to use to open specific types of files. Git also has the idea of a “default editor”. It uses this editor when you write a commit message, and in certain other circumstances. You should set this editor to a convenient text editor that you like to use.

First, install a text editor you like. We have a list of good editors you can choose from. Try setting up that editor’s extensions for your favorite programming language; for example, Visual Studio Code has extensions for R and Python that provide interactive consoles and debuggers.

Second, run one of these commands in a terminal (or Git Bash), depending on the editor you picked:

# Visual Studio Code:
git config --global core.editor "code --wait"

# Atom:
git config --global core.editor "atom --wait"

# Emacs: ask Alex, as the command depends on your operating system setup.

# Vim:
git config --global core.editor vim

Note that RStudio does not support being used as the Git editor, so you should install an editor like Visual Studio Code as a backup editor.

Also, you can use any of these editors at the command line to edit a file. For example, run the command code foo.txt to open the file foo.txt in Visual Studio Code to edit.

Create a Class Directory and Move There #

Now move to your home directory. Create the s750 directory and move into it.

cd ~
mkdir s750
cd s750

The s750 directory is where you will keep all your work for this course throughout the semester.

Setting Up Your Repositories #

When you have Git installed and have a GitHub account, do the following. Otherwise, you should do both steps before proceeding.

If you try to do this later, remember to do it only after doing cd ~/s750 first.

  1. Clone the course repositories

    git clone
    git clone

    You will probably need to use your GitHub username and password.

    If you get an error when you run the second command, you need to check your email for the GitHub invitation to join the 36-750 organization, and accept the invitation. Wait for this invitation before proceeding. It may not arrive immediately – we send the invitations manually every day or so.

    1. Clone your assignment repository. Do
    git clone

    replacing YOURUSERNAME with your GitHub account name in the command.

  2. Verify that everything looks right:

    ls ~/s750

    should list three directories: documents, problem-bank, and assignments-YOURUSERNAME. If this is not what you see, verify that you followed the steps above, or ask us for help.

    Installing the new-homework Script #

    The new-homework script is provided in your assignment repository. Before you can run the script, you’ll need to install a Python package that lets Python scripts use Git. Run

    pip install GitPython

and let it install the GitPython package. (This is like installing a package from CRAN in R.)

Move to your assignment repository and try running the script to make sure it worked. It should print out a brief summary of its options:

cd ~/s750/assignments-YOURUSERNAME

If you get a message like “command not found”, something is wrong with your Python installation. Check that you have it installed or ask us for help.

Directions for using the new-homework command are provided in the Assignment Instructions.