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.

Chapter 2: Software Setup

A minimal Python and notebook environment for COMP 521

This chapter installs the supported course baseline:

Project 1 needs NumPy, Matplotlib, and a notebook kernel. Later project briefs will name any additional packages they require.

Why use an environment?

An environment is a named collection of one Python interpreter and its packages. Activating comp521 gives course work a stable place without modifying the Python that your operating system may use.

computer
├── system software        ← leave this alone
└── comp521 environment    ← course Python and packages

Isolation prevents many package conflicts. It does not, by itself, make every computer byte-for-byte identical; project repositories and project-specific instructions own any stricter dependency contract.

Step 1: Install Miniforge

Download the installer for your operating system and processor from the official Miniforge download page.

macOS
Linux
Windows
  1. If you are unsure which processor you have, run uname -m in Terminal. arm64 means Apple Silicon; x86_64 means Intel.

  2. Download the official signed .pkg installer for Apple Silicon or Intel, then open the downloaded package.

  3. Install for your user, accept the default location, and allow the installer to initialize your shell.

  4. Close every Terminal window and open a new one.

Verify the installation in a fresh terminal:

conda --version

A version number is success. If the command is not found, first confirm that you opened a new terminal after installation.

Step 2: Create the course environment

Create the minimal P1 environment once:

conda create --name comp521 python=3.11 numpy matplotlib jupyter ipykernel gh

Review the proposed package plan, then enter y when conda asks whether to proceed. Activate the environment:

conda activate comp521

Your prompt should now include (comp521). Verify the interpreter and core imports:

which python
python -c "import sys; print(sys.executable)"
python --version
python -c "import numpy, matplotlib; print('COMP 521 imports work')"
gh --version

Both interpreter-path commands should point inside the comp521 environment. which python is convenient in Git Bash and other Bash-compatible shells; python -c "import sys; print(sys.executable)" works across shells. Python should report version 3.11, the import command should print its success message, and gh should report a GitHub CLI version. Installing gh in the same cross-platform environment gives every supported operating system the browser authentication path used in Chapter 3.

Daily environment commands

CommandPurpose
conda activate comp521enter the course environment
conda deactivateleave the current environment
conda env listshow available environments
conda listshow packages in the active environment
which pythonshow which Python a Bash-compatible shell will run
python -c "import sys; print(sys.executable)"show the active Python across shells

Step 3: Install VS Code

  1. Download and install Visual Studio Code.

  2. Open the Extensions view with Ctrl + Shift + X (Windows/Linux) or Command + Shift + X (macOS).

  3. Install these two extensions from Microsoft:

    • Python

    • Jupyter

No theme, formatter, AI assistant, or extension bundle is required.

Open a project and select its kernel

From a project directory, try:

code .

If code is not available in your shell, use File → Open Folder in VS Code. On macOS you may optionally install the shell command from the Command Palette with Shell Command: Install ‘code’ command in PATH.

For a Python file, open the Command Palette and choose Python: Select Interpreter, then select comp521. For a notebook, use the kernel picker at the upper right and select the Python kernel from comp521. VS Code records this choice per project folder.

Local notebook check

Create an untitled notebook only for this check, select the comp521 kernel, and run:

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0.0, 1.0, 5)
plt.plot(x, x**2, marker="o")
plt.xlabel("x")
plt.ylabel("x²")
plt.show()

Success means the cell completes and displays one labeled curve. Close the untitled notebook without saving. This local check establishes that your laptop is ready to use Python and Jupyter in Thursday’s class.

AI completion settings

The authoritative rules are in the AI Use & Growth Mindset Policy. During Projects 1–3, automatic AI-generated code completions must be disabled because core solution code is your work. Disable Copilot, Cursor-style completion, or any comparable generative extension if it is installed.

Normal editor features such as syntax highlighting, bracket matching, documentation pop-ups, and ordinary IntelliSense may remain enabled. The policy also permits defined tutoring and verification uses after a genuine attempt; it does not impose a blanket ban on asking for explanations.

Setup evidence

Before continuing, confirm:

Complete this local setup check before class Thursday, August 27. The separate Project 1 Repository Check is completed by pushing one setup commit in Chapter 3.

Troubleshooting from evidence

SymptomBounded next step
conda: command not foundOpen a new terminal. Confirm Miniforge installed for your user. On Windows, try the exact conda init bash step from Miniforge Prompt once.
EnvironmentNameNotFound: comp521Run conda env list. If the environment is absent, repeat the create command; if it exists under another name, preserve the output and ask for help.
ModuleNotFoundErrorRun conda activate comp521, which python, python -c "import sys; print(sys.executable)", and conda list <package>.
VS Code shows the wrong PythonOpen the project folder, then select the comp521 interpreter or kernel again.
Kernel will not startRecord the VS Code notification and Jupyter output; confirm python -c "import ipykernel" works in the active environment.
Installation stalls or cannot reach a serverSave the complete network error and try the same command once on a stable network. Do not add an unknown proxy or clear caches blindly.

Post a shared setup question on the Canvas discussion board or use Canvas Inbox for a private issue. Include your operating system, exact command or UI action, complete error, and the outputs of conda env list and which python when relevant.