Computational Analysis of Social Complexity
Fall 2025, Spencer Lyon
Prerequisites
- Laptop or personal computer with internet connection
Outcomes
- Install Julia and IJulia locally
- Install VS Code
- Open lecture notes locally
References
- Lecture notes
- QuantEcon lectures
Step 1: Install Julia¶
- The first step is to install Julia
Task: Install Julia¶
- Windows: windows users can install Julia from the microsoft store OR by running
winget install --name Julia --id 9NJNWW8PVKMN -e -s msstorefrom powershell - Mac/Linux: Open terminal and run
curl -fsSL https://install.julialang.org | sh(it is safe -- I promise ;))
Task: Launch Julia REPL¶
Launch the Julia REPL (read-eval-print-loop) by clicking on the Julia icon or running julia from your shell (PowerShell or Terminal)
You will be greeted with a prompt that looks like this:
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.6 (2025-07-09)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> You are now in what is called the Julia REPL (read-eval-print-loop). This is a place where you can type Julia commands and have them executed immediately.
Test it out by typing rand(2, 2) and pressing enter
You should see something like this (note the numbers will be different for you):
julia> rand(2, 2)
2×2 Matrix{Float64}:
0.698944 0.676245
0.17375 0.448243Congratulations! You have successfully installed Julia and are ready to move on to the next step!
Step 2: Install IJulia.jl¶
- With Julia installed we are now ready to install some Julia packages
- The first package we’ll be using is called IJulia
- This is a package integrates with Jupyter to allow us to run Julia code from notebooks
- Same Jupyter you may have used with Python
Task: Install IJulia¶
Launch the Julia REPL (by typing julia from the Linux/OSX terminal prompt or using the start menu on Windows)
At the juila> prompt, type ]
Prompt will switch to (@v1.11) pkg>
Once there type add IJulia and press enter
IJulia.jl will be downloaded and installed on your machine
Task: Start IJulia¶
At the juila> prompt (press backspace to exit Pkg mode if needed), type using IJulia
Then run the command: IJulia.notebook()
A web browser should pop open with the IJulia.jl interface (should look similar to what I’m using)
Step 3: Install Visual Studio Code¶
- While we can and will use the native Julia REPL and first-party Jupyter software for our lecture notes, it is also helpful to have the ability to edit and run Julia code in a more full-featured editor
- For this we will use Visual Studio Code (VSCode)
- VSCode is a free, open-source, cross-platform editor that has a large community of users and developers
- It also has great support for Julia
- Learning how to use a general purpose text editor will help you in the long run
- You can use it for Julia, Python, R, C, C++, etc.
- You can use it for writing papers, taking notes, etc.
Note on VS Code alternatives: There are several popular forks/alternatives to VS Code that provide enhanced features, particularly for AI-assisted coding:
- Cursor: An AI-first code editor built on VS Code with enhanced AI capabilities
- Windsurf: Another AI-powered editor with advanced coding assistance features
These alternatives generally maintain compatibility with VS Code extensions (including the Julia extension), so you can use any of them for this course if you prefer. The instructions below will work for VS Code and most of its forks.
Task: Download/Install VS Code¶
Download and install VSCode from here
Follow all system prompts and accept default options
Open/launch VSCode
Task: Install Julia extension¶
- VSCode has a large ecosystem of extensions that add functionality to the editor
- We will install the Julia extension to add Julia support to VSCode
In VSCode, click on the “Extensions” icon in the left-hand toolbar (looks like a box with four squares in it)
Search for “Julia” and click the “Install” button on the “Julia” extension (subtitle is “Julia Language Support”)
Task: run Julia code in VSCode¶
- We can now run Julia code in VSCode
- Open a new file in VSCode (File -> New File)
- Type the following code into the file:
println("Hello world!")- Save the file as
hello.jlin a location you can find later - Press
Ctrl + Shift + P(orCmd + Shift + Pon Mac) to open the command palette - Type “Julia” and select “Julia: Run file in new process”
- You should see the output of the code show up in a new terminal window within VS Code
Task: run code with shift + Enter¶
Go back to hello.jl and add the code
n = 5
P = rand(n, n)Then, put your cursor on the line that contains n = and press shift and enter at the same time
This will start a new Julia REPL within your VS Code session and execute the code for you
It will also move your cursor down to the P = line. Press shift + enter again to execute that line
Open Notebooks Locally¶
- You should view/follow along with lectures on the your computer
- Being able to run code on your machine is critical for success in this course and will allow you to take skills with you after the course
Task: Download notebooks¶
- Go to the course website and download the notebooks for the first week
- Move the downloaded folder from your “Downloads” folder to wherever you’d like to store materials for the semester
- Follow the instructions above to start Julia, load IJulia, and open the Jupyter notebook with IJulia
- Inside your local Jupyter notebook instance (in your web browser), navigate to where you copied the “Handouts” folder and open up this notebook
Task: Open notebook in vscode¶
- You can also run Jupyter notebooks directly in VS Code
- Open VS Code and click on the “File” menu and select “Open Folder”
- Navigate to where you copied the notebooks for the first week
- Click on the “L01.02_setup.ipynb” file in the left-hand toolbar
- You should see the notebook open in VS Code
- You can run cells by clicking the “Run Cell” button in the top right of each cell, or by pressing
Shift + Enterwhile your cursor is in the cell- A menu will appear, choose the option containing
Julia Release
- A menu will appear, choose the option containing
- Test this out below
# some random Julia code
println("That's all, folks!")That's all, folks!