Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Note: None of the following software setup is required for the completion of assignments in this class, however utilizing an integrated development environment and Git is highly recommended for the final project.

Installing Python

To run Python code on your own computer, as opposed to the remote computer used by JupyterHub, you’ll need to install Python locally on your computer. Visit python.org and follow the instructions for your computer’s operating system.

VSCode

Installing VSCode

For a local alternative to JupyterHub, we recommend installing VSCode. Again, be sure to follow the instructions based on your computer’s operating system!

VSCode Extensions

Once you’ve downloaded VSCode, you’ll need to install extensions for Python and Jupyter Notebooks. Inside of VSCode, navigate to the Extensions menu in the left sidebar, search for Python, and install the Python extension from Microsoft. Next, search for Jupyter, and install the Jupyter (not JupyterHub) extension from Microsoft.

Using VSCode

Open a new terminal by opening the Terminal dropdown menu at the top, and selecting New Terminal. From here, you can use all the same commands we’ve learned to use on JupyterHub, but instead on your own computer! Using VSCode’s built-in GUI, you can open existing files, create new files and directories, and run Python files and Jupyter Notebooks. You will do most of this through the Explorer menu on the left side bar.

Installing Dependencies

Libraries/dependencies such as pandas and matplotlib come standard with our instances of JupyterHub, but to use them locally on your computer, you’ll need to install them as well. We’ll do so by using a virtual environment.

Virtual Environments

To install the necessary dependencies, we recommend creating a virtual environment for each project you work on. Virtual environments allow you to install the necessary dependencies project by project. This avoids any issues with code from one project requiring a different version of a library than code from another project! We recommend using Miniconda to create your virtual environments, though there are alternatives such as Anaconda and Python’s built-in venv.

First, start by installing Miniconda on your computer:

Using Miniconda

Once you’ve installed Miniconda, navigate to VSCode and open a new terminal.

Create a new virtual environment using the following command:

conda create -n <NAME> python=3.13

where <NAME> is replaced with a name for this environment. You should name it something corresponding to your project, like 163project. Note that the version of Python specified is not the newest version, but the version that is installed on JupyterHub. Feel free to use newer versions of Python if you’d like.

To use this newly created virtual environment, you’ll need to activate it using the following command:

conda activate <NAME>

You should see your command line change to include the name of your environment.

Install dependencies by running:

conda install <library_name>

where <library_name> is the name of the library you would like to install, such as pandas or matplotlib. The library name you use in this command is often the name you see in the import statements we’ve been using at the top of each file, such as import pandas as pd. Please reach out to the course staff if you are having trouble installing a particular library.

Global Environment

Though we recommend using virtual environments for installing and managing dependencies, you may alternatively install dependencies into your global environment. This environment is shared between all projects you work on, and thus may lead to some version conflicts. To install dependencies into your global environment, use the same command as you would to install dependencies into a Miniconda environment, but replace conda with pip, such as pip install pandas. Again, we highly recommend creating a virtual environment instead of doing this.

Git

Installing Git

Whether you’re working in a group that requires collaboration on code, or are working by yourself and want an organized history of your edits, we recommend setting up a GitHub repository for your project’s code. Using Git allows you to seamlessly collaborate with others, while maintaining a reliable version history of your entire project, file by file! Before setting up and using a repository, you’ll need to install Git on your computer like you did with Python. Visit git-scm.com to install Git. Again, be sure to follow the instructions for your computer’s operating system.

Creating a Git Repository

If you haven’t already, create a GitHub account using the link above. Once you’ve created an account, click the green New button to create a new repository. Enter a repository name and an optional description. Select the visibility for your repository:

The next three options (Add README, Add .gitignore, Add license) are all optional, and GitHub provides links on this creation page if you’d like to learn more about these options.

Once you’re happy with your setup, select Create Repository. You’ve successfully created your own remote GitHub repository! You can add files to it manually, or clone it to your computer to edit from there.

Cloning your Repository to VSCode

In VSCode, click the Accounts icon at the bottom of the left sidebar (the person icon), select Sign in with GitHub, and follow the prompts to sign in through your browser. Once you’re done, you’ll be returned to VSCode.

Open the command palette with Ctrl+Shift+P for Windows/Linux or Cmd+Shift+P for Mac, then type and select Git: Clone. You have two options:

Next, choose a local folder on your computer to clone the repository into. Once cloning finishes, VSCode will ask if you’d like to open the cloned repository.

Collaborating with Others

If you’re working in a group, you’ll want to give your teammates access to the repository. On your repository’s GitHub page, go to Settings > Collaborators and add your group members by their GitHub usernames. Each collaborator can then clone the repository to their own computer using the steps above.

Git tracks changes through a cycle of committing (saving a snapshot of your changes), pushing (uploading your commits to GitHub), and pulling (downloading your teammates’ commits). You can run this whole cycle from a terminal in VSCode. Open a new terminal instance, and make sure you’re inside your repository’s folder.

  1. Pull first. Before you start working, download your teammates’ latest changes:

    git pull
  2. Make your edits to the project files as usual.

  3. Stage your changes. Tell Git which changed files to include in your next snapshot. To stage everything you’ve changed:

    git add .

    (You can also stage a specific file with git add <filename>.)

  4. Commit. Save the staged changes as a snapshot with a short message describing what you did:

    git commit -m "Add data cleaning function"
  5. Push. Upload your commits to GitHub so your teammates can see them:

    git push

A good habit is to pull before you push (git pull, then git push). If two people edit the same part of the same file, Git will report a merge conflict. This just means Git isn’t sure which version to keep, so it marks the conflicting sections in the file for you to choose between. Don’t panic if this happens; resolving conflicts is a normal part of collaboration, and course staff are happy to help you work through this. To avoid conflicts in the first place, teammates often work on separate files, or use separate branches and merge their work together through a pull request. These concepts are covered in more depth in Lessons 5.2 and 5.3.