Wicked Smart Data
LearnInsightsAboutContact
Sign InLet's Build
LearnInsightsAboutContact
Sign InLet's Build
Wicked Smart Data

Intelligence, automation, and expert execution — plus an elite library of free knowledge. We turn complexity into competitive advantage.

Start a conversation

Platform

  • Learning Paths
  • Insights
  • RSS Feed

Company

  • About
  • Contact
  • Work With Us

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Wicked Smart Data. All rights reserved.

Intelligence · Automation · Advantage

All Insights
Python

Setting Up Python for Data Analysis: Python, VS Code, Jupyter, and Virtual Environments

Getting your Python environment wrong is the fastest way to kill your momentum before you write a single line of analysis code. This lesson walks you through installing Python, VS Code, and Jupyter correctly — and shows you why virtual environments are the professional habit that saves hours of future frustration.

🌱 Foundation17 min readSep 22, 2026Updated Sep 22, 2026
Setting Up Python for Data Analysis: Python, VS Code, Jupyter, and Virtual Environments
On this page
  • Introduction
  • Understanding the Pieces Before You Install Anything
  • Step 1: Installing Python
  • Choosing the Right Installer
  • Windows Installation
  • macOS Installation
  • Linux Installation
  • Verifying the Installation
  • Step 2: Installing VS Code
  • Setting Up VS Code for Python
  • Step 3: Creating Your Project Folder
  • Step 4: Creating a Virtual Environment
  • Why Virtual Environments Exist
  • Creating the Environment
  • Activating the Environment
  • Step 5: Installing Data Analysis Packages
  • Step 6: Connecting VS Code to Your Virtual Environment
  • Step 7: Creating and Running a Jupyter Notebook
  • Anatomy of a Jupyter Notebook
  • Your First Real Code
  • Hands-On Exercise
  • Common Mistakes & Troubleshooting
  • "python is not recognized" on Windows
  • Jupyter won't start or kernel won't connect
  • "Module not found: No module named 'pandas'"
  • Permission errors on macOS when running pip
  • PowerShell won't run the activation script on Windows
  • Summary & Next Steps
  • Setting Up Python for Data Analysis: Python, VS Code, Jupyter, and Virtual Environments

    Introduction

    Imagine you've just been handed a folder of CSV files — monthly sales reports, customer records, maybe some inventory data — and your manager wants a cleaned-up summary by Friday. You've heard Python can do in seconds what takes you an hour in Excel, but when you go to get started, you hit a wall of questions: Do I download Python from python.org or somewhere else? What's VS Code? What even is a "virtual environment"? The setup phase stops more people than the actual coding does.

    That's exactly what this lesson fixes. We're going to walk through every step of getting a proper Python data analysis environment running on your machine, from zero to writing your first real line of pandas code. This isn't a cursory "just install Python and go" guide — we'll explain why each piece exists and how they all fit together, so you're not blindly following steps that break the moment something goes slightly differently on your computer.

    By the end of this lesson, you'll have a professional-grade setup that mirrors how working data analysts actually operate. Every tool we install has a specific job, and you'll understand that job before you install it.

    What you'll learn:

    • What Python is and how to install it correctly for data work
    • How VS Code functions as your coding workspace and how to configure it
    • What Jupyter notebooks are and why data analysts prefer them for exploration
    • Why virtual environments exist and how to create and activate one
    • How to install packages like pandas and verify your setup is working

    Understanding the Pieces Before You Install Anything

    Before we touch a single installer, let's build a mental model of the tools involved. This is worth five minutes of your time, because it will save you hours of confusion later.

    Think of your data analysis workflow as a kitchen. Python is the cooking technique — the fundamental skill that makes everything possible. VS Code is your kitchen itself — the workspace with all your counters, drawers, and good lighting where you actually do the work. Jupyter notebooks are a specific type of cooking journal where you can write a step, execute it immediately, see the result, and then write the next step. And virtual environments are like having separate sets of ingredients and tools for different recipes, so your Italian cooking supplies never accidentally contaminate your baking.

    Each tool has a distinct role:

    • Python (the interpreter): The program that reads your code and actually executes it. When you write sales_total = sum(monthly_sales), Python is what makes that addition happen.
    • VS Code: A code editor — essentially a very smart text editor that understands programming languages. It gives you features like color-coded syntax, error highlighting, and the ability to run code.
    • Jupyter: An interface that lets you write code in cells, run individual cells, and see outputs (including charts and tables) right below the code that created them. Extremely popular for data exploration because you can experiment piece by piece.
    • Virtual environments: Isolated Python installations for each project, so the packages you install for one project don't conflict with another.

    Key insight

    Many beginners install Python and start writing code directly in a global environment. This works until it doesn't — usually when two projects need different versions of the same package and they start breaking each other. Starting with virtual environments from day one is a professional habit worth building immediately.


    Step 1: Installing Python

    Choosing the Right Installer

    Go to python.org/downloads in your browser. The site will detect your operating system and offer you the latest stable version. As of this writing, any Python 3.10, 3.11, or 3.12 release is excellent for data work. You want the "stable release" — not a pre-release or release candidate.

    Warning

    Do not install Python from the Microsoft Store if you're on Windows. It creates a sandboxed version with permission quirks that cause subtle problems when installing packages. Always download directly from python.org.

    Click the download button for your OS and run the installer.

    Windows Installation

    When the installer window opens, you'll see a checkbox at the very bottom that says "Add Python to PATH." Check this box before you do anything else. It's unchecked by default, and if you miss it, Python installs but your terminal won't be able to find it.

    After checking that box, click "Install Now." The installer handles the rest.

    macOS Installation

    Run the downloaded .pkg file and follow the prompts. After installation completes, open the Terminal application (find it in Applications → Utilities → Terminal) and run:

    python3 --version
    

    You should see something like Python 3.12.2. On macOS, the command is python3, not python, because older Macs had Python 2 installed by the system and Apple kept both names available.

    Linux Installation

    Most Linux distributions come with Python 3 pre-installed. Verify with:

    python3 --version
    

    If you need to install or upgrade, use your package manager. On Ubuntu or Debian:

    sudo apt update
    sudo apt install python3 python3-pip python3-venv
    

    Verifying the Installation

    Open a terminal (on Windows, search for "Command Prompt" or "PowerShell" in the Start menu) and type:

    python --version
    

    On macOS/Linux, use python3 --version. You should see your version number printed back. If you see an error like "python is not recognized," the PATH wasn't set correctly — on Windows, re-run the installer and ensure that checkbox is ticked.

    You also want to verify pip, Python's package manager (the tool you use to install libraries like pandas):

    pip --version
    

    This should return a version number and a file path.


    Step 2: Installing VS Code

    VS Code (Visual Studio Code) is a free code editor from Microsoft. Despite the "Microsoft" origin, it runs equally well on Windows, macOS, and Linux and has become the most widely used code editor in the world, across all programming languages.

    Go to code.visualstudio.com and download the version for your operating system. Run the installer with default options.

    Setting Up VS Code for Python

    VS Code is designed to work with many programming languages, so Python support is added through an extension. After VS Code opens:

    1. Look at the left sidebar. You'll see a column of icons. The one that looks like four squares (three arranged in an L, one slightly detached) is the Extensions marketplace. Click it.
    2. In the search bar that appears, type "Python".
    3. The first result should be the Python extension by Microsoft (it will have millions of downloads). Click Install.

    This extension is what allows VS Code to understand Python syntax, run Python files, and connect to virtual environments.

    While you're in the Extensions panel, also install the Jupyter extension by Microsoft. This lets you work with Jupyter notebooks directly inside VS Code — which is the workflow we'll use throughout this learning path.

    Tip

    VS Code will sometimes show a notification asking you to "Select a Python Interpreter" after installing the Python extension. Ignore this for now — we'll select the right interpreter after we create our virtual environment in a few minutes.


    Step 3: Creating Your Project Folder

    Before we create a virtual environment, let's establish where your project will live. Virtual environments are tied to specific project folders, so the folder comes first.

    Open your terminal and navigate to wherever you keep your projects. If you're new to the terminal, here's what you need:

    • cd stands for "change directory" — it's how you navigate folders
    • mkdir creates a new folder
    • ls (macOS/Linux) or dir (Windows) lists what's in the current folder

    Create a folder for this practice project:

    cd Documents
    mkdir data-analysis-practice
    cd data-analysis-practice
    

    Now open this folder in VS Code. You can do this from the terminal:

    code .
    

    The . means "current folder." VS Code will open with your data-analysis-practice folder loaded in the file explorer on the left.


    Step 4: Creating a Virtual Environment

    Here's where many tutorials skip the explanation and just give you commands to copy. We're not doing that, because understanding this will save you real frustration.

    Why Virtual Environments Exist

    When you install a package with pip install pandas, it installs pandas into your Python installation. If you install it globally (without a virtual environment), it goes into the system-wide Python. Now imagine you have two projects: one needs pandas version 1.5 for compatibility with some legacy code, and another project needs pandas version 2.1 for a new feature. They can't both be installed globally at the same time.

    A virtual environment is a self-contained copy of Python with its own package directory. Project A activates its virtual environment and sees pandas 1.5. Project B activates its virtual environment and sees pandas 2.1. They never interfere.

    Note

    The virtual environment doesn't copy the entire Python interpreter each time — it mostly creates a folder structure with its own package storage and some small configuration files that point back to the base Python installation. They're lightweight.

    Creating the Environment

    In your terminal, make sure you're inside your data-analysis-practice folder. Then run:

    python -m venv venv
    

    On macOS/Linux:

    python3 -m venv venv
    

    Breaking this down: python -m venv tells Python to run its built-in venv module. The last word venv is the name of the folder it will create for your virtual environment. You could name it anything, but venv is the near-universal convention, and using it means other developers (and VS Code's auto-detection) will immediately recognize what that folder is.

    After running this, you'll see a new folder called venv appear in your project directory. Don't edit anything inside it manually.

    Activating the Environment

    Creating the environment doesn't automatically switch you into it. You have to activate it:

    Windows (Command Prompt):

    venv\Scripts\activate
    

    Windows (PowerShell):

    venv\Scripts\Activate.ps1
    

    macOS/Linux:

    source venv/bin/activate
    

    After activation, your terminal prompt will change. You'll see (venv) appear at the beginning of the line, like this:

    (venv) C:\Users\YourName\Documents\data-analysis-practice>
    

    That (venv) prefix is your confirmation that the virtual environment is active. Any pip install commands you run now will install packages into this environment only.

    Warning

    If you close your terminal and open a new one, you need to activate the virtual environment again. The activation doesn't persist between sessions. Many developers get caught by this — they wonder why their packages "disappeared" when they're actually just looking at the global Python again.


    Step 5: Installing Data Analysis Packages

    With your virtual environment active, install the core packages for data analysis:

    pip install pandas openpyxl jupyter notebook
    

    Let's clarify what each package does:

    • pandas: The primary data manipulation library for Python. Think of it as a programmatic spreadsheet — it handles loading, cleaning, reshaping, and analyzing tabular data.
    • openpyxl: A package that lets pandas read and write Excel files (.xlsx). Without it, pd.read_excel() will fail with a confusing error.
    • jupyter and notebook: The Jupyter ecosystem — what powers the interactive notebook interface.

    The installation will take a minute or two. You'll see a series of "Downloading..." and "Installing..." messages scroll by. That's normal.

    Verify the installation worked:

    pip list
    

    This prints every package installed in your current environment. Scroll through and confirm you see pandas, openpyxl, jupyter, and notebook listed.


    Step 6: Connecting VS Code to Your Virtual Environment

    VS Code needs to know which Python interpreter (which virtual environment) to use for this project. Here's how to tell it:

    1. In VS Code, press Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on macOS. This opens the Command Palette — a search bar for all VS Code commands.
    2. Type "Python: Select Interpreter" and press Enter.
    3. VS Code will scan your project folder and offer a list of available Python interpreters. You should see one that includes venv in its path — something like Python 3.12.2 ('venv': venv) with a path pointing into your project folder.
    4. Select that one.

    You'll see the selected interpreter appear in the bottom status bar of VS Code. This tells VS Code: "When I run Python code in this project, use this Python, not some other one."


    Step 7: Creating and Running a Jupyter Notebook

    Now let's bring everything together. Inside VS Code, with your project folder open:

    1. Click the New File button in the Explorer panel (the folder icon in the left sidebar) — it's a page icon with a small plus sign.
    2. Name the file exploration.ipynb. The .ipynb extension stands for "IPython Notebook," the historical name for Jupyter notebooks.
    3. VS Code will open the notebook interface, showing an empty cell ready for input.

    Anatomy of a Jupyter Notebook

    A notebook is made up of cells. There are two main types:

    • Code cells: Where you write Python. When you run a cell, Python executes it and displays the output directly below.
    • Markdown cells: Where you write text, formatted with Markdown (headers, bold, bullet points). Great for notes, explanations, and documenting what you're doing.

    The interactive, cell-by-cell execution model is what makes Jupyter invaluable for data exploration. You can load a dataset in one cell, clean it in the next, write a summary in a markdown cell, visualize it in another code cell — and at any point, re-run just the cell you're working on without re-running the whole script.

    Your First Real Code

    Click into the first empty cell. Make sure it's set to "Code" (VS Code shows this in a dropdown in the top-right of the cell). Type this:

    import pandas as pd
    
    # Create a small sample dataset representing monthly sales
    data = {
        'month': ['January', 'February', 'March', 'April', 'May'],
        'region': ['North', 'North', 'South', 'South', 'North'],
        'sales': [42300, 38900, 51200, 47800, 55100],
        'units': [283, 261, 342, 319, 368]
    }
    
    df = pd.DataFrame(data)
    df
    

    Run the cell by pressing Shift+Enter or clicking the play button (triangle icon) that appears to the left of the cell when you hover over it.

    You should see a table rendered below the cell, showing your data in a clean, spreadsheet-style format:

         month region  sales  units
    0  January  North  42300    283
    1 February  North  38900    261
    2    March  South  51200    342
    3    April  South  47800    319
    4      May  North  55100    368
    

    This is pandas in action. The pd.DataFrame() function created a structured table from your dictionary. The df at the end of the cell is how Jupyter knows to display it — in a regular Python script, you'd need print(df), but in a notebook, a bare variable or expression on the last line gets displayed automatically.

    Tip

    The standard convention is to import pandas as pd — you'll see this in virtually every piece of Python data analysis code in existence. It's not required, but deviating from it will make your code look odd to any collaborator.

    Let's add one more cell. Press Shift+Enter with the cursor in the first cell (it runs the cell and creates a new one below), then type:

    # Summary statistics for numeric columns
    df.describe()
    

    Run this cell and you'll see count, mean, standard deviation, min, and max for your sales and units columns. That's one line of code to get what would take several formulas in Excel.


    Hands-On Exercise

    Complete these steps to verify your setup is fully functional:

    Part 1: Recreate the environment from scratch. Create a new folder called sales-analysis. Navigate to it in your terminal, create a fresh virtual environment, activate it, and install pandas and jupyter.

    Part 2: Build a notebook. Open VS Code in the new folder, create a notebook called sales_summary.ipynb, and connect it to your virtual environment's interpreter.

    Part 3: Write analysis code. In the notebook, create a DataFrame representing six months of sales data for two products of your choice. Include at minimum: a month column, a product column, a revenue column, and a quantity column. Then:

    • Display the full DataFrame
    • Use df.describe() to show summary statistics
    • Use df['revenue'].sum() to print total revenue
    • Add at least one Markdown cell explaining what the data represents

    Part 4: Verify isolation. Deactivate your virtual environment (deactivate in the terminal), then run pip list. Notice the packages look different — pandas likely isn't there. This confirms your project packages are isolated. Reactivate the environment to confirm pandas reappears in pip list.


    Common Mistakes & Troubleshooting

    "python is not recognized" on Windows

    You either didn't check "Add Python to PATH" during installation, or you installed from the Microsoft Store. Re-run the python.org installer, choose "Modify," and ensure PATH is included. Alternatively, search for "Environment Variables" in Windows settings and manually add Python's installation folder.

    Jupyter won't start or kernel won't connect

    This almost always means VS Code is using the wrong Python interpreter — probably the global one instead of your virtual environment's. Go through the "Python: Select Interpreter" step again and confirm the path includes venv.

    "Module not found: No module named 'pandas'"

    Your code is running in an environment where pandas isn't installed. Either your virtual environment isn't activated (check for the (venv) prefix in your terminal), or VS Code is pointing to the wrong interpreter. Check both.

    Permission errors on macOS when running pip

    If you see permission errors, you're likely accidentally installing into the system Python instead of your virtual environment. Verify activation and try again. Never use sudo pip install — it installs into the system Python as root, which can cause serious problems.

    PowerShell won't run the activation script on Windows

    Windows PowerShell has a security policy that blocks unsigned scripts by default. Run this command once in PowerShell as Administrator:

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
    

    Then try activating again.

    Tip

    If you're repeatedly hitting environment issues, the nuclear option is to delete the venv folder entirely and recreate it from scratch. Virtual environments are cheap to recreate — always check that your packages are correctly listed in pip list after recreating.


    Summary & Next Steps

    You've built a complete, professional Python data analysis environment. Let's recap what each piece does:

    • Python (from python.org) is the language interpreter — the engine that runs your code.
    • VS Code is your development workspace — where you write, organize, and run code.
    • The Python and Jupyter extensions bridge VS Code to your Python installation and enable notebook support.
    • Virtual environments give each project its own isolated package space, preventing conflicts and keeping your work reproducible.
    • pandas, openpyxl, jupyter are the core tools for loading, analyzing, and exploring tabular data interactively.

    Every analyst working in Python uses some version of this setup. The habits you've built here — creating a virtual environment first, installing packages into it, connecting your editor to the right interpreter — will prevent entire categories of problems as your projects grow in complexity.

    The next step in this learning path is getting comfortable with pandas fundamentals: loading real data from CSV and Excel files, understanding what a DataFrame actually is, and performing your first selections and filters. The environment you set up today is the launchpad for all of that work.

    For day-to-day use, keep these commands in your back pocket:

    # Start a new project
    mkdir my-project && cd my-project
    python -m venv venv
    source venv/bin/activate   # or venv\Scripts\activate on Windows
    pip install pandas openpyxl jupyter
    
    # Return to an existing project
    cd my-project
    source venv/bin/activate   # activate every time you open a new terminal
    code .                     # open VS Code
    

    You're set up. Let's start analyzing data.

    Work With Us

    From insight to implementation

    Reading is the start. When you're ready to build the data, automation, or AI systems behind it, our team turns strategy into shipped results.

    Let's Build

    Python for Data Analysis

    Next

    Python Basics for Excel Users: Variables, Lists, Dictionaries, and Loops

    Related Insights

    PythonPractitioner

    Building an Inventory Aging Report in pandas: Classifying Stock by Days on Hand, Flagging Slow Movers, and Exporting a Tiered Summary to Excel

    22 min
    PythonFoundation

    Calculating Descriptive Statistics in pandas: mean, median, std, and describe for Summarizing Numeric Columns Before You Analyze

    15 min
    PythonExpert

    Building a pandas Attribution Model: Allocating Revenue Across Multi-Touch Customer Journeys Using First-Touch, Last-Touch, and Linear Attribution Rules

    24 min

    On this page

    • Introduction
    • Understanding the Pieces Before You Install Anything
    • Step 1: Installing Python
    • Choosing the Right Installer
    • Windows Installation
    • macOS Installation
    • Linux Installation
    • Verifying the Installation
    • Step 2: Installing VS Code
    • Setting Up VS Code for Python
    • Step 3: Creating Your Project Folder
    • Step 4: Creating a Virtual Environment
    • Why Virtual Environments Exist
    • Creating the Environment
    • Activating the Environment
    • Step 5: Installing Data Analysis Packages
    • Step 6: Connecting VS Code to Your Virtual Environment
    • Step 7: Creating and Running a Jupyter Notebook
    • Anatomy of a Jupyter Notebook
    • Your First Real Code
    • Hands-On Exercise
    • Common Mistakes & Troubleshooting
    • "python is not recognized" on Windows
    • Jupyter won't start or kernel won't connect
    • "Module not found: No module named 'pandas'"
    • Permission errors on macOS when running pip
    • PowerShell won't run the activation script on Windows
    • Summary & Next Steps