Python Environment Setup
It is strongly suggested to get GitHub’s student developer pack which gives you lots of free stuff (and even access to the AI GitHub Copilot ).
Similarly, it is strongly recommended to install VS Code for easy access to both the repositories, and a coding environment to run jupyter notebooks.
All of the slides in these lectures are available as Juptyer notebooks in a github repository, https://github.com/jlperla/grad_econ_datascience_notebooks
NOTE: Relative to other instructions you may see, these emphasize the newer uv Python installation rather than the increasingly outdated Anaconda. The small changes are worth the effort for speed of installation/setup as well as better support for reproducibiilty.
Quick Start
To install a Python and Jupyter environment:
Setup a GitHub ID and apply for the GitHub’s student developer pack
-
- NOTE: For further instructions when using VS Code, you can access different features through the command palette by
<Cmd+Shift+P>or<Ctrl+Shift+P>depending on your OS, and then typing in text. When you are given instructions with a>(e.g.,> Git: clone) it indicates you should search for that text.
- NOTE: For further instructions when using VS Code, you can access different features through the command palette by
Install uv, which is strongly recommended instead of
conda(although both can coexist)- MacOS or Linux:
curl -sSfL https://raw.githubusercontent.com/astral-sh/uv/main/install.sh | sh, from any terminal - Windows:
iwr https://raw.githubusercontent.com/astral-sh/uv/main/install.ps1 -useb | iex, from a Windows PowerShell terminal (i.e., Open the Start menu, type Windows PowerShell, select Windows PowerShell, then select Open.)
- MacOS or Linux:
In VS Code, clone the notebook version of this website
<Cmd+Shift+P>to enter into the VS Code command palette, then typecloneto select> Git: clone- Paste in the repository URL:
https://github.com/jlperla/grad_econ_datascience_notebooksand choose to open a new window with the repository - If prompted, you likely want to associate your github ID with VS Code to make git operations easier.
Start a terminal in VS Code (e.g.,
`<Ctrl+`>or from the menuTerminal/New Terminal)In the terminal, install the appropriate
uvpackages and python withuv syncSometimes optional, but helpful to choose the default python environment for a cloned repository with
> Python: Select Interpreterand choose./.venv/bin/pythonon macos/linux or.\.venv\Scripts\python.exeon windows (likely the default).In the new window, open files such as
slides/probability.ipynbas Jupyter Notebooks.- If necessary, choose the Jupyter kernel as the
Python Environments...then choose the./.venv/bin/pythoninterpreter
- If necessary, choose the Jupyter kernel as the
The python package dependencies are enumerated in the pyproject.toml and uv.lock files. If these are ever changed when you update the notebooks, you can simply run uv sync to install the latest versions.