Tutorial 0: Setting Up Your Machine for Python Data Analysis

Introduction

Before diving into any of the practicals in this series — creating DataFrames, cleaning data, building charts, or running EDA — you need a properly configured machine. This chapter walks you through everything required to get from a blank computer to a fully working Python data analysis environment, ready for every tutorial in this series (Tutorial 1–10).

By the end of this chapter, you’ll have:

  1. Python installed on your machine
  2. A working package manager (pip)
  3. JupyterLab installed and running
  4. All required libraries (Pandas, Matplotlib, Seaborn, NumPy) installed
  5. A dedicated project folder and virtual environment
  6. A verified, working “Hello World” notebook

1. Check If Python Is Already Installed

Most machines (especially Mac and Linux) come with some version of Python pre-installed. Before installing anything, check what you already have.

Open your terminal (Command Prompt or PowerShell on Windows, Terminal on Mac/Linux) and run:

python --version

or, on some systems:

python3 --version

What are we checking for?
This series uses modern Pandas features (like the "ME" resample codes in Chapter 9), so you’ll want Python 3.10 or later. If you see something like Python 3.12.4, you’re in good shape. If you see an error like command not found, or a very old version (2.x or below 3.9), you’ll need to install a fresh copy.


2. Install Python

Windows:

  1. Go to python.org/downloads
  2. Download the latest stable installer (e.g., Python 3.12.x)
  3. Run the installer, and critically, check the box that says “Add Python to PATH” before clicking Install
  4. Verify the installation by reopening your terminal and running python --version

Mac:
The easiest route is via Homebrew:

brew install python

Alternatively, download the macOS installer directly from python.org.

Linux (Ubuntu/Debian):

sudo apt update
sudo apt install python3 python3-pip

Why does “Add to PATH” matter?
PATH is the list of folders your operating system searches through when you type a command. If Python isn’t added to PATH, typing python in your terminal won’t work, even though Python is installed somewhere on your disk.


3. Understand pip (Python’s Package Manager)

pip is the tool that installs Python libraries (like Pandas and Matplotlib) from the internet. It comes bundled with Python automatically, so you shouldn’t need to install it separately.

Verify it’s working:

pip --version

If that doesn’t work, try:

pip3 --version

Update pip to the latest version (good practice before installing anything else):

pip install --upgrade pip

4. Create a Dedicated Project Folder

Before installing libraries, create a clean folder to keep this tutorial series organized:

mkdir python-data-analysis
cd python-data-analysis

This becomes the home for all your notebooks (like 01_First_Data_Analysis.ipynb from Chapter 1) and any CSV files you create along the way.


5. (Recommended) Set Up a Virtual Environment

A virtual environment is an isolated Python setup for a single project — it keeps this series’s libraries separate from anything else on your machine, so upgrades or installs here can’t break other Python projects.

Create one:

python -m venv venv

Activate it:

Windows:

venv\Scripts\activate

Mac/Linux:

source venv/bin/activate

Once activated, you’ll see (venv) appear at the start of your terminal prompt — that’s your confirmation it’s active. Any library you install now will live inside this isolated environment.

Why bother with this?
Without it, every library you install applies globally to your entire machine. Over time, different projects can require conflicting versions of the same library. A virtual environment sidesteps that problem entirely — it’s considered standard practice for any real Python project.

(If you’d rather skip this for now and install everything globally, that’s fine for following along with these tutorials — just be aware it’s a shortcut, not the long-term best practice.)


6. Install JupyterLab

All ten tutorials in this series are designed to be run inside Jupyter Notebooks — interactive documents that combine code, output, and explanations.

Install JupyterLab:

pip install jupyterlab

Launch it:

jupyter lab

OR
python -m jupyter lab

This opens JupyterLab in your default web browser (typically at http://localhost:8888). From here, you can create a new notebook exactly as described in Chapter 1:

File → New → Notebook → Python 3


7. Install the Core Data Analysis Libraries

Now install every library used across this tutorial series in one go:

pip install pandas numpy matplotlib seaborn

Here’s what each one does, and where you’ll use it:

LibraryPurposeUsed In
pandasTabular data (DataFrames), reading CSVs, cleaning, groupingChapters 1–3, 6–10
numpyNumerical operations, handling missing values, conditional logicChapters 3, 7, 10
matplotlibCharts and visualizationsChapters 1, 4, 6
seabornStatistical visualizations built on MatplotlibChapters 5, 6, 7, 8

If you ever need to install a library from inside a Jupyter Notebook cell directly (rather than the terminal), use the %pip magic command, as shown in Chapter 5:

%pip install seaborn

8. Verify Your Installation

Create a new notebook and run this quick verification cell:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

print("Pandas version:", pd.__version__)
print("NumPy version:", np.__version__)
print("Matplotlib version:", plt.matplotlib.__version__)
print("Seaborn version:", sns.__version__)

If this cell runs without any errors and prints out version numbers, your environment is fully set up and ready for every tutorial in this series.


9. A Quick “Hello World” Test

As one final sanity check, try this simple chart — if it renders correctly, you’re 100% ready for Chapter 1:

import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4], [10, 20, 25, 30], marker="o")
plt.title("Setup Test Chart")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()

You should see a small line chart with four points appear directly below the code cell.


10. Recommended Code Editor (Optional)

While JupyterLab (browser-based) is all you need for this series, some learners prefer working inside a full code editor:

  • VS Code — free, lightweight, with an excellent Jupyter extension (search “Jupyter” in the Extensions panel) that lets you run notebooks directly inside the editor
  • PyCharm — a fuller-featured Python IDE, with built-in Jupyter support in its Professional edition

Either is optional — everything in this series was written and tested purely in JupyterLab.


11. Deactivating the Virtual Environment (When You’re Done)

When you finish a working session, you can exit the virtual environment with:

deactivate

Next time you return to this project, just cd back into the folder and run the activation command from Step 5 again before launching Jupyter.


Complete Setup Checklist

Check Python version
      ↓
Install Python (if needed)
      ↓
Verify pip
      ↓
Create project folder
      ↓
Create & activate virtual environment (recommended)
      ↓
Install JupyterLab
      ↓
Install pandas, numpy, matplotlib, seaborn
      ↓
Verify installation
      ↓
Ready for Chapter 1

Troubleshooting Common Issues

ProblemLikely CauseFix
python: command not foundPython not added to PATHReinstall Python and check “Add to PATH,” or use python3 instead
pip: command not foundpip missing or not on PATHTry python -m pip install --upgrade pip
jupyter: command not foundJupyterLab not installed, or venv not activatedRe-run pip install jupyterlab inside your activated environment
Charts don’t display in notebookMissing plt.show() or outdated MatplotlibAdd plt.show() at the end of every plotting cell
ModuleNotFoundError: No module named 'seaborn'Library installed in a different environmentMake sure your venv is activated, then reinstall

Key Takeaway: A properly configured Python environment — Python itself, pip, a virtual environment, JupyterLab, and the core libraries (Pandas, NumPy, Matplotlib, Seaborn) — is the foundation every practical in this series depends on. Once this setup is verified, you’re ready to begin with Chapter 1: Your First Data Analysis with Python.

Scroll to Top