Case Study 2.2: Maya Sets Up on a MacBook
The Situation
Maya Reyes has been meaning to start learning Python for eight months. She has a MacBook Pro (M2, macOS Ventura 13.4) that she uses for everything: client work, invoicing, business development.
Her goal: get set up properly so she can build toward the invoicing automation she outlined in Chapter 1. She has Saturday morning free.
The macOS Peculiarity
Her first discovery: macOS already has Python installed.
python3 --version
Python 3.9.7
She reads the chapter and understands: this is the system Python. She shouldn't modify it. She needs her own Python 3.12 installation from python.org.
She downloads and runs the macOS installer. Now:
python3 --version
Python 3.12.0
But wait — which python3 is this running? She checks:
which python3
/usr/local/bin/python3
That's the one she just installed (not /usr/bin/python3, which is the system Python). She's on the right path.
The Jupyter Decision
Maya decides to install Jupyter immediately, even though the book says she won't use it heavily until Part 2. Her reasoning: she's seen Jupyter notebooks in blog posts about data analysis and wants to understand what all the fuss is about.
python3 -m venv maya-consulting/venv
source maya-consulting/venv/bin/activate
pip install pandas matplotlib seaborn openpyxl requests jupyter
She launches Jupyter:
jupyter notebook
A browser window opens. She creates a new notebook. In the first cell, she types:
# Maya's first Jupyter cell
company = "Maya Reyes Consulting"
hourly_rate = 175
hours_this_month = 87
monthly_revenue = hourly_rate * hours_this_month
print(f"This month's revenue: ${monthly_revenue:,}")
Output: This month's revenue: $15,225
She looks at the output for a moment. That's actually pretty close to her real this-month revenue. The numbers are real. This is working on real business data. The abstraction evaporates.
The Terminal Confusion
Maya has two issues with the terminal that are worth documenting.
Issue 1: She has multiple terminal windows open. She activates the venv in one window, forgets, switches to another, and tries to run Python there. Gets an ImportError for pandas (because the second terminal doesn't have the venv activated).
Resolution: She starts using VS Code's integrated terminal exclusively. One window, always activated. The (maya-consulting/venv) prefix becomes her north star.
Issue 2: She notices that closing the terminal and reopening VS Code resets the activation. She adds a note to herself: "Activate venv every time you open the project."
Later, she discovers VS Code does this automatically when you open a folder with a venv inside it. This feels like discovering a cheat code.
The Requirements File
At the end of her setup session, Maya runs:
pip freeze > requirements.txt
She opens the file and sees 40+ lines of packages and version numbers. Most she didn't explicitly install — they're dependencies of the packages she did install. This is the first time she consciously understands that installed libraries depend on other libraries.
She keeps the file. In three months, when she sets up Python on a new client's machine to run her invoicing script, she'll understand exactly why this file matters.
What Maya Learns
- The system Python on macOS is real and she should leave it alone
python3vspython(andpip3vspip) is the macOS convention and not a problem- Jupyter Notebooks show output inline in ways that make data feel immediate and tangible
- VS Code's auto-activation of virtual environments saves a class of mistakes
requirements.txtcontains your packages plus all their dependencies
Discussion Questions
- Why does macOS have Python pre-installed? What's the macOS system Python actually used for?
- Maya's terminal confusion (multiple windows, one activated, one not) is a common beginner mistake. What organizational habits prevent it?
- Maya's
requirements.txtcontained 40+ packages when she only explicitly installed 7. Explain why this happens and why it's important to track even the packages you didn't explicitly install. - Maya chose to install Jupyter "early" even though the book didn't require it yet. Is this a good learning strategy or a source of potential distraction? When is it beneficial to explore ahead, and when should learners stick to the prescribed path?