Skip to content

Installing Data Science Libraries (pip & conda)

A common starter stack for data analytics includes:

  • NumPy: numerical computing
  • Pandas: data manipulation
  • Matplotlib: plotting foundation
  • Seaborn: statistical visualization
  • Plotly: interactive charts
  • Jupyter: notebooks
  • SciPy (optional early): scientific utilities
  • scikit-learn (later): ML utilities
  • You’re using Anaconda/Miniconda
  • You want fewer build/compile issues
  • You need compiled dependencies (common in data science)
  • You installed CPython from python.org
  • You’re inside a venv
  • A package isn’t available via conda

Step 1: Create and activate an environment

Section titled “Step 1: Create and activate an environment”
command
conda create -n analytics python=3.12
command
conda activate analytics
command
conda install numpy pandas matplotlib seaborn jupyter

Plotly is often available via conda, but some users prefer pip. Try conda first:

command
conda install plotly

If not available in your channels, use pip:

command
pip install plotly
command
python -m venv .venv
command
source .venv/bin/activate
command
pip install numpy pandas matplotlib seaborn plotly jupyter

After installing packages, verify them in a Python session or notebook:

verify
import numpy as np
import pandas as pd
import matplotlib
import seaborn as sns
import plotly
 
print("NumPy:", np.__version__)
print("Pandas:", pd.__version__)
print("Matplotlib:", matplotlib.__version__)
print("Seaborn:", sns.__version__)
print("Plotly:", plotly.__version__)

Installing Jupyter kernel for your environment

Section titled “Installing Jupyter kernel for your environment”

Sometimes Jupyter is installed globally but you want the kernel to point at your environment.

Install ipykernel:

command
pip install ipykernel

Register the kernel:

command
python -m ipykernel install --user --name analytics --display-name "Python (analytics)"

Now your environment appears in Jupyter kernel selection.

For long projects, pin versions so your notebook still runs months later.

text
numpy==2.1.0
pandas==2.2.3
matplotlib==3.9.2
seaborn==0.13.2
plotly==5.24.1
jupyter==1.1.1
yaml
name: analytics
channels:
  - conda-forge
dependencies:
  - python=3.12
  - numpy
  - pandas
  - matplotlib
  - seaborn
  - plotly
  - jupyter

Use this decision path whenever you’re not sure which installer to reach for.

diagram pip vs conda decision mermaid
Which installer to use depending on how your environment was created

Error: ModuleNotFoundError: No module named 'pandas'

Section titled “Error: ModuleNotFoundError: No module named 'pandas'”
  • You installed in one environment but are running Python from another.
  • Solution: activate the correct environment and reinstall.

Error: Jupyter doesn’t show the right kernel

Section titled “Error: Jupyter doesn’t show the right kernel”
  • Install and register ipykernel as shown above.
  • Check you’re using the intended pip:
    • In a terminal inside the environment, run which pip (macOS/Linux)
    • Or where pip (Windows)

Phase 1 is complete. Next we’ll start Phase 2: Numerical Computing (NumPy) with an Introduction to NumPy.

Exercise 2 – Build a requirements.txt From a Dict

Section titled “Exercise 2 – Build a requirements.txt From a Dict”

Exercise 3 – Verify Imports Like a Setup Script

Section titled “Exercise 3 – Verify Imports Like a Setup Script”

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading