luvv to helpDiscover the Best Free Online Tools
Topic 2 of 30

Installing and Environment Setup

Learn Installing and Environment Setup for free with explanations, exercises, and a quick test (for Data Analyst).

Published: December 20, 2025 | Updated: December 20, 2025

Why this matters

As a Data Analyst, you will run notebooks, clean data, and prototype models. A clean Python environment with pandas avoids version conflicts, broken notebooks, and lost time. With a reproducible setup, teammates can run your work without “it works on my machine” issues.

  • Quickly spin up a project-specific environment for an analysis.
  • Install pandas and related libraries without breaking other projects.
  • Launch Jupyter with the correct kernel every time.

Who this is for

  • Beginners setting up pandas for the first time.
  • Analysts who need reliable, project-based environments.
  • Anyone migrating between pip/venv and conda and wants clarity.

Prerequisites

  • Basic terminal/command prompt usage.
  • Python installed (recommended: 3.9–3.12).
  • Ability to install software on your machine.
Quick check: Do I have Python?
python --version   # or: python3 --version

If the version is not shown, install Python from your OS package manager or official installer, then re-open your terminal.

Concept explained simply

An environment is a self-contained folder with its own Python and packages. You activate it, install pandas there, and your project uses exactly those versions—no surprises.

Mental model

Think of each environment as a toolbox for one job. Different projects can have different toolboxes. Activating an environment means you’re opening the right toolbox for the task.

Step-by-step setup

  1. Choose your manager
    • pip + venv: Lightweight, built into Python. Great default.
    • conda: Package manager + environments. Helpful for complex stacks.
  2. Create a project folder
    mkdir pandas-project && cd pandas-project
    
  3. Option A — pip + venv
    python -m venv .venv
    
    Activate the environment
    • Windows (PowerShell):
      .venv\Scripts\Activate.ps1
      
    • Windows (CMD):
      .venv\Scripts\activate.bat
      
    • macOS/Linux:
      source .venv/bin/activate
      
    python -m pip install --upgrade pip
    python -m pip install pandas jupyterlab ipykernel
    
  4. Option B — conda
    conda create -n da-pandas python=3.11 pandas jupyterlab ipykernel -y
    conda activate da-pandas
    
  5. Add a Jupyter kernel for this environment (recommended)
    python -m ipykernel install --user --name py-pandas --display-name "Python (pandas env)"
    
  6. Verify installation
    python -c "import pandas as pd; print('pandas', pd.__version__)"
    

    Expected: a version like pandas 2.x.x (numbers vary by system).

  7. Launch JupyterLab
    jupyter lab
    

    When creating a new notebook, pick the kernel named Python (pandas env).

Worked examples

Example 1: pip + venv in a clean folder
  1. Create and activate:
    mkdir wk1 && cd wk1
    python -m venv .venv
    # Activate (see OS note above)
    python -m pip install --upgrade pip
    python -m pip install pandas jupyterlab ipykernel
    
  2. Verify:
    python -c "import pandas as pd; print(pd.__version__)"
    
  3. Register kernel:
    python -m ipykernel install --user --name wk1 --display-name "Python (wk1)"
    
See expected terminal output
Successfully installed pandas-2.x.x ...
>> 2.x.x
Installed kernelspec wk1 in ...
Example 2: conda environment for a project
  1. Create and activate:
    conda create -n sales-eda python=3.11 pandas jupyterlab ipykernel -y
    conda activate sales-eda
    
  2. Verify:
    python -c "import pandas as pd; print(pd.__version__)"
    
  3. Optional: add kernel name:
    python -m ipykernel install --user --name sales-eda --display-name "Python (sales-eda)"
    
Example 3: Confirm the kernel is available in Jupyter
  1. List kernels:
    jupyter kernelspec list
    
  2. Start JupyterLab and choose your kernel:
    jupyter lab
    

    In the top-right Kernel picker, select Python (pandas env) (or your custom name).

  3. Create a new notebook and run:
    import pandas as pd
    print(pd.__version__)
    

Troubleshooting

pip vs pip3 vs python -m pip

On some systems, pip points to Python 2 or another Python. Safest is:

python -m pip install pandas

This ensures pip runs inside the active Python environment.

Activation issues
  • Check which Python you are using:
    where python   # Windows
    which python   # macOS/Linux
    
  • Ensure your prompt shows the env name (e.g., (.venv) or (sales-eda)).
Permission errors (EACCES) on macOS/Linux

Use a virtual environment or conda. Avoid sudo pip install in system Python. If needed for user installs:

python -m pip install --user pandas
Conda solving is slow or stuck
  • Try creating a fresh environment instead of updating a tangled one.
  • Specify Python version during creation to reduce conflicts (e.g., python=3.11).
Jupyter shows the wrong Python
  • Ensure you installed an ipykernel from the active env:
python -m ipykernel install --user --name py-pandas --display-name "Python (pandas env)"
  • In Jupyter, change the kernel to the one you created.

Hands-on exercises

These mirror the exercises below. Do them now to lock in the setup.

  1. Exercise 1: Create a new folder, make a venv, activate it, and install pandas, jupyterlab, and ipykernel. Verify the pandas version.
  2. Exercise 2: Launch Python (or a notebook) and create a tiny DataFrame to confirm pandas works end-to-end.

Self-check checklist

  • I can activate/deactivate my environment without errors.
  • python -c "import pandas as pd; print(pd.__version__)" prints a version.
  • jupyter lab launches, and I can select the correct kernel.
  • I can import pandas in a notebook and run a few lines.

Common mistakes and how to self-check

  • Installing packages globally: Fix by creating an environment and reinstalling inside it.
  • Mixing managers (pip inside base conda unintentionally): Either use conda-only or activate the right env before installing.
  • Wrong Python interpreter in Jupyter: Add a kernel from the environment and switch to it.
  • Skipping pip upgrade: Old pip can fail SSL or wheel builds. Run python -m pip install --upgrade pip.

Practical projects

  • Reproducible starter: Create a pandas-starter folder with .venv, requirements.txt, and a notebooks/ directory. Freeze dependencies with python -m pip freeze > requirements.txt.
  • Environment switch demo: Make two environments with different pandas versions, and record the outputs of pd.__version__ in each.
  • Data read smoke test: In a notebook, use StringIO to load a small CSV string into a DataFrame and show df.head().

Learning path

  • This subskill: set up a reliable environment and Jupyter kernel.
  • Next: Data ingestion and DataFrame basics (Series, DataFrame, reading CSV/Excel).
  • Then: Data cleaning, joins, aggregations, time series, plotting.

Next steps

  • Keep one environment per project.
  • Document your setup in a short README.md with the activation and kernel instructions.
  • Practice launching Jupyter and picking the correct kernel until it feels automatic.

Saving your progress

The quick test is available to everyone. Only logged-in users will have their test and exercise progress saved automatically.

Mini challenge

Create a new environment named mini-pandas, install pandas, register a Jupyter kernel with a friendly display name, and run a notebook cell that prints pd.__version__ and the shape of a small DataFrame created from a list of dicts.

Need a tiny dataset to try?
import pandas as pd
rows = [
    {"city": "Berlin", "sales": 120},
    {"city": "Paris",  "sales": 150},
    {"city": "Rome",   "sales": 90}
]
df = pd.DataFrame(rows)
print(df.shape)
print(df.head())

Quick Test

When you are ready, take the Quick Test below. Available to everyone; only logged-in users will see saved progress.

Practice Exercises

2 exercises to complete

Instructions

  1. Create a project folder and navigate into it:
    mkdir ex1-setup && cd ex1-setup
    
  2. Create and activate a virtual environment:
    python -m venv .venv
    # Activate (choose one):
    # Windows PowerShell: .venv\Scripts\Activate.ps1
    # Windows CMD: .venv\Scripts\activate.bat
    # macOS/Linux: source .venv/bin/activate
    
  3. Upgrade pip and install packages:
    python -m pip install --upgrade pip
    python -m pip install pandas jupyterlab ipykernel
    
  4. Verify the pandas version:
    python -c "import pandas as pd; print(pd.__version__)"
    
Expected Output
A version string like 2.x.x prints to the console (exact numbers vary). No import errors.

Installing and Environment Setup — Quick Test

Test your knowledge with 8 questions. Pass with 70% or higher.

8 questions70% to pass

Have questions about Installing and Environment Setup?

AI Assistant

Ask questions about this tool