Installing Python, Jupyter, and VS Code
# CHAPTER 2
Installing Python, Jupyter, and VS Code
1. Chapter Introduction
Before you can analyze data, you need the right tools. Setting up a Python environment can be confusing for beginners because there are multiple ways to do it. This chapter walks you through the industry-standard ways to install Python and Jupyter Notebook, focusing on Anaconda for beginners and VS Code integration for professionals.2. Method 1: The Anaconda Distribution (Recommended for Beginners)
Anaconda is a massive, all-in-one package. When you install Anaconda, you automatically get:
- 1. Python
- 2. Jupyter Notebook
- 3. Essential Data Science libraries (Pandas, NumPy, Matplotlib)
- 4. A graphical interface to manage it all.
Step-by-Step Installation:
- 1. Go to anaconda.com/download.
- 2. Download the installer for your operating system (Windows, macOS, Linux).
- 3. Run the installer. Leave all default settings (specifically, you *do not* need to check "Add Anaconda to my PATH" unless you know what you are doing).
- 4. Once installed, open the application called "Anaconda Navigator".
Launching Jupyter from Anaconda:
- 1. Inside Anaconda Navigator, you will see a grid of applications.
- 2. Find the tile labeled Jupyter Notebook.
- 3. Click Launch.
-
4.
A black terminal window will open (do not close this!), followed by your default web browser opening to
http://localhost:8888.
3. Method 2: pip Install (For Advanced Users)
If you already have Python installed and prefer a lightweight setup without Anaconda, you can use Python's package manager, pip.
Step-by-Step Installation:
- 1. Open your Terminal (Mac/Linux) or Command Prompt (Windows).
- 2. Run the following command:
- 3. Once the installation completes, start Jupyter by running:
- 4. Your browser will open to the Jupyter interface.
4. Method 3: VS Code Integration (The Professional Choice)
Visual Studio Code (VS Code) is currently the most popular code editor in the world. It has built-in, seamless support for Jupyter Notebooks, allowing you to write notebooks without ever opening a web browser.
Step-by-Step Setup:
- 1. Download and install VS Code from code.visualstudio.com.
-
2.
Open VS Code and click on the Extensions icon on the left sidebar (or press
Ctrl+Shift+X).
- 3. Search for and install the "Python" extension (published by Microsoft).
- 4. Search for and install the "Jupyter" extension (published by Microsoft).
Creating a Notebook in VS Code:
-
1.
Press
Ctrl+Shift+P(Windows) orCmd+Shift+P(Mac) to open the Command Palette.
-
2.
Type
Jupyter: Create New Blank Notebookand press Enter.
-
3.
Save the file. Notice that it automatically saves with a
.ipynbextension.
5. Understanding Localhost
When you launch Jupyter from the terminal or Anaconda, a web browser opens to a URL that looks like this:
http://localhost:8888/tree
6. Mini Project: Hello World Notebook
Let's verify your installation works.
- 1. Launch Jupyter Notebook (via Anaconda, terminal, or VS Code).
- 2. Create a new Python 3 notebook.
- 3. Click on the first empty cell and type:
-
4.
Hold
Shiftand pressEnterto run the cell.
-
5.
If you see the text "Hello, Jupyter World!" and the number
30appear below the cell, your installation is successful!
7. Common Mistakes
- Closing the Terminal Window: If you launch Jupyter from Anaconda or the command prompt, a black terminal window stays open in the background. If you close this window, the Jupyter server dies, and your browser interface will stop working. Minimize it, don't close it!
- Multiple Python Installations: Installing Python from python.org, then installing Anaconda, can cause path conflicts. Stick to one method (Anaconda is best for beginners).
8. MCQs
What is the easiest way for a beginner to install Python, Jupyter, and data science libraries all at once?
When Jupyter opens in your web browser at localhost:8888, does it require an active internet connection?
What happens if you close the black terminal window that opens when you launch Jupyter Notebook?
Which VS Code extensions are required to run notebooks natively inside VS Code?
What command do you type in the terminal to launch a pip-installed Jupyter Notebook?
What file extension denotes a Jupyter Notebook file?
In VS Code, how do you quickly create a new notebook using the keyboard?
Anaconda Navigator is?
If you just want a lightweight installation without the massive Anaconda package, you should use?
How do you execute the code inside a Jupyter cell?
9. Interview Questions
- Q: Explain the architecture of Jupyter. Why does it open in a web browser if it's running locally?
- Q: What is the difference between setting up a project environment using Anaconda vs. using standard Python with pip/venv?
10. Summary
You have three main paths to set up Jupyter: Anaconda (best for absolute beginners, includes everything), pip (for users comfortable with the terminal), and VS Code (the modern professional standard). Regardless of how you launch it, Jupyter runs a local server on your machine (localhost) and uses your web browser as its graphical interface.