Setup: Anaconda, Jupyter & VS Code
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.
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.
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)
.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.conda --version. You should see a version number printed back.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
.ipynb keeps both the code and its last output, so results are visible without re-running anything.Creating and Running Your First Notebook
jupyter notebook. This starts a local server and opens the Jupyter file browser in your web browser.your_name.ipynb.# 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.
# Cell 2 — x and y are still available; the notebook shares one session total = x + y print(f"x + y = {total}")
A quick look at inline plotting
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.
.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..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.
# 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 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)
# 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
# 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
Lesson Summary
Let's recap everything you learned in this lesson:
conda package manager together..ipynb) is made of cells you run individually, with output — including plots — shown inline.jupyter notebook from a terminal to launch Jupyter, then use Shift+Enter to run a cell..ipynb files.pip install package installs third-party libraries; conda install is an alternative inside conda environments.conda create -n or python -m venv) keeps each project's dependencies isolated.Now it's your turn: get a real notebook running.
Install Anaconda (or confirm it's already installed), launch Jupyter, and create a new notebook named
setup_check.ipynb with exactly three cells:
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 numpyfails, it likely isn't installed in the environment your notebook's kernel is using