📊 Section 1 · Foundations 🟢 Beginner MODULE 02

Setup: Anaconda, Jupyter & VS Code

⏱️ 20 min read
📖 Theory + Setup
🧩 5 Quiz Questions
🏗️ 1 Challenge
Your progress in Section 129%
🎯 What you'll learn: How to install Anaconda, what a Jupyter notebook actually is and why data scientists live inside them, how to create and run your first notebook, VS Code as an alternative workflow, the basics of pip install, and how to create an isolated virtual environment for your projects.

Why a Proper Setup Matters

A plain Python install is enough to write scripts, but data science work leans on a handful of specialized libraries — NumPy, Pandas, Matplotlib — plus a way to run code interactively, inspecting a chart or a table right after you produce it instead of only seeing text scroll past in a terminal.

That's the gap Anaconda and Jupyter notebooks fill. This lesson gets both installed and working, then shows VS Code as a lighter alternative once you're comfortable.

📦
Anaconda
A Python distribution that bundles Python itself with the most common data science libraries pre-installed.
📓
Jupyter Notebook
An interactive, cell-based environment for running Python code and seeing results — including charts — inline.
💻
VS Code
A general-purpose code editor that can also run Jupyter notebooks through its official extension.
📥
pip / conda
Package managers that install third-party libraries like NumPy and Pandas into your Python environment.

Installing Anaconda

Anaconda is a free Python distribution built specifically for data science. Instead of installing Python and then separately installing NumPy, Pandas, Matplotlib, Jupyter, and dozens of their dependencies one by one, Anaconda installs all of it — and the conda package manager — in a single setup.

💡
Anaconda vs. plain Python
Plain Python from python.org gives you the language and the standard library only. Anaconda gives you Python plus a curated science stack, the conda package/environment manager, and Jupyter — all ready to go. That's why most data science courses (including this one) recommend it for beginners.

Installation Steps (Windows / macOS / Linux)

1
Download the installer
Go to anaconda.com/download and download the installer for your operating system (the "Individual Edition" / free distribution).
2
Run the installer
On Windows, launch the .exe and follow the prompts (installing "for just me" is fine). On macOS, run the .pkg installer. On Linux, run the downloaded shell script with bash Anaconda3-*.sh.
3
Verify the installation
Open Anaconda Prompt (Windows) or a regular terminal (macOS/Linux) and type conda --version. You should see a version number printed back.
4
Launch Anaconda Navigator (optional)
Anaconda installs a graphical launcher called Navigator where you can open Jupyter, VS Code, and other tools with a click — handy while you're getting comfortable with the terminal.
⚠️
Anaconda is large — that's normal
The installer is several gigabytes because it bundles hundreds of scientific packages. If disk space is tight, Miniconda (a minimal installer with just conda and Python) is a lighter alternative — you then install only the packages you need.

What Is a Jupyter Notebook?

A Jupyter notebook is a document — saved with a .ipynb extension — made up of a sequence of cells. Each cell holds either Python code or formatted text (Markdown), and you run cells one at a time, in any order you choose, rather than executing an entire file top to bottom.

Why data scientists live in notebooks

▶️
Cell-by-cell execution
Run one step, inspect the result, then decide what to try next — no re-running the whole script.
📊
Inline plots
Charts from Matplotlib or Seaborn render directly beneath the cell that created them.
📝
Markdown + code together
Mix explanations, headings, and even math notation with the code that produced a result.
🔁
Iterative exploration
Data exploration is rarely linear — notebooks match how you actually poke at a dataset.
💾
Persisted output
A saved .ipynb keeps both the code and its last output, so results are visible without re-running anything.
🤝
Easy to share
One file captures narrative, code, and results together — useful for reports and walkthroughs.
A cell's output sticks around
Each code cell remembers the variables it created, so a later cell can use them — the notebook keeps one shared Python session running behind all its cells until you restart it.

Creating and Running Your First Notebook

1
Launch Jupyter
Open a terminal (or Anaconda Prompt) in the folder you want to work in and run jupyter notebook. This starts a local server and opens the Jupyter file browser in your web browser.
2
Create a new notebook
Click New → Python 3 in the top-right corner. A new, empty notebook opens with a single empty cell.
3
Type code and run the cell
Click into the cell, type some Python, then press Shift + Enter to run it and move to the next cell (creating one if needed).
4
Rename and save
Click the "Untitled" title at the top to rename your notebook, and use Ctrl/Cmd + S to save. Your file is saved as your_name.ipynb.
first_notebook.ipynb — Cell 1 (code)
PYTHON
# Cell 1 — this runs immediately when you press Shift + Enter
print("Hello from my first Jupyter notebook!")

x = 7
y = 5
x + y  # in a notebook, the last expression's value is displayed automatically

Running that cell prints the greeting, and also displays 12 underneath — even without a print() call. This is one of Jupyter's most useful habits: the value of the last line in a cell is shown automatically, which makes quick inspection fast.

first_notebook.ipynb — Cell 2 (code, using an earlier variable)
PYTHON
# Cell 2 — x and y are still available; the notebook shares one session
total = x + y
print(f"x + y = {total}")
⚠️
Cell order can bite you
Because cells can be run out of order, it's easy to end up with a notebook where the visible code no longer matches what's actually in memory. Use the Kernel → Restart & Run All menu option regularly to confirm your notebook still works top to bottom.

A quick look at inline plotting

first_notebook.ipynb — Cell 3 (a preview of inline plots)
PYTHON
import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4], [10, 20, 15, 30])
plt.title("A tiny preview chart")
plt.show()  # the chart renders directly below this cell — no separate window

You'll learn Matplotlib properly in Section 3 — for now, just notice that the chart appears right in the notebook, beneath the cell that created it. That instant feedback loop is the whole point of working this way.

Alternative: VS Code with the Jupyter Extension

Once you're comfortable with notebooks, many data scientists move to editing .ipynb files inside VS Code instead of the browser-based Jupyter interface — you get the same cell-based experience, plus VS Code's autocomplete, debugging, and Git integration.

1
Install VS Code
Download it from code.visualstudio.com if you don't already have it.
2
Install the Python and Jupyter extensions
Open the Extensions panel (the four-squares icon) and install "Python" and "Jupyter", both published by Microsoft.
3
Open or create a notebook
Open an existing .ipynb file, or create a new one via Ctrl/Cmd+Shift+P → "Create: New Jupyter Notebook". Cells, output, and inline plots all work the same way as in the browser.
4
Select the right kernel
Click the kernel picker in the top-right of the notebook and choose your Anaconda Python installation so the notebook can see NumPy, Pandas, and the rest of the stack.
Notebook or plain .py file?
Use notebooks for exploration — poking at a dataset, trying out a chart, testing an idea. Once code is settled and needs to run repeatedly or be imported elsewhere, move it into a regular .py file. Both live comfortably side by side in VS Code.

pip install Basics

pip is Python's standard package installer. Even with Anaconda, you'll eventually need a library that isn't bundled by default — pip install is how you get it.

Terminal — installing and checking packages
BASH
# Install a single package
pip install requests

# Install a specific version
pip install pandas==2.2.0

# Install everything listed in a requirements file
pip install -r requirements.txt

# See what's installed and which versions
pip list

# Check details about one package
pip show numpy
📝
pip vs. conda install
Inside an Anaconda environment you can use either pip install package or conda install package. conda also resolves non-Python dependencies (like compiled C libraries), which is why it's often preferred for heavier scientific packages — but both work for most everyday installs.

Creating a Virtual Environment

A virtual environment is an isolated, self-contained Python installation for a single project. Without one, every package you install lands in one shared, global Python — and two projects that need different versions of the same library will conflict.

Using conda (recommended alongside Anaconda)

Terminal — conda environments
BASH
# Create a new environment named "datasci" with Python 3.11
conda create -n datasci python=3.11

# Activate it
conda activate datasci

# Install packages inside the active environment
conda install numpy pandas matplotlib jupyter

# Leave the environment
conda deactivate

Using Python's built-in venv module

Terminal — venv (works without Anaconda)
BASH
# Create a virtual environment in a folder called "venv"
python -m venv venv

# Activate it — Windows
venv\Scripts\activate

# Activate it — macOS / Linux
source venv/bin/activate

# Once active, install as usual
pip install numpy pandas

# Leave the environment
deactivate
⚠️
One environment per project
It's tempting to install everything into a single global environment and never think about it again — but the moment two projects need conflicting versions of the same library, you'll be glad you kept them separate from the start.

Lesson Summary

Let's recap everything you learned in this lesson:

Anaconda is a Python distribution that bundles Python, the data science stack, and the conda package manager together.
A Jupyter notebook (.ipynb) is made of cells you run individually, with output — including plots — shown inline.
Run jupyter notebook from a terminal to launch Jupyter, then use Shift+Enter to run a cell.
VS Code with the Python and Jupyter extensions can open and run the same .ipynb files.
pip install package installs third-party libraries; conda install is an alternative inside conda environments.
A virtual environment (conda create -n or python -m venv) keeps each project's dependencies isolated.
🧩 Knowledge Check — Lesson 2
Answer all 5 questions to test your understanding. Instant feedback on every answer.
1. What does Anaconda bundle together in one installer?
2. What keyboard shortcut runs the current cell in a Jupyter notebook?
3. In a Jupyter notebook, what happens to the value of the last expression in a cell?
4. Which command installs a third-party Python package using pip?
5. Why use a virtual environment for each project?
💪
Coding Challenge — Lesson 2
Apply what you learned · Beginner Level

Now it's your turn: get a real notebook running.

Challenge: Your First Working Notebook 📓

Install Anaconda (or confirm it's already installed), launch Jupyter, and create a new notebook named setup_check.ipynb with exactly three cells:

Cell 1 (Markdown): a heading titled "My Setup Check"
Cell 2 (Code): print a message confirming Python works
Cell 3 (Code): import numpy and pandas, then print both version numbers

Rules: Cell 1 must be a Markdown cell (change the cell type with the dropdown in the toolbar). Cell 3 should use numpy.__version__ and pandas.__version__. Save the notebook when you're done.
💡 Show hints if you're stuck
  • Change a cell to Markdown from the dropdown that normally says "Code" in the toolbar
  • A Markdown heading looks like # My Setup Check
  • Version check: import numpy as np; print(np.__version__)
  • If import numpy fails, it likely isn't installed in the environment your notebook's kernel is using
Finished this lesson?
Mark it complete to track your progress.
🎉

Lesson 2 Complete!

Your environment is ready — Anaconda, Jupyter, and optionally VS Code. Next up: a fast refresher on the Python idioms you'll use constantly in data science code.

Module 02 of 7 Section 1 — Python for Data Science Foundations