iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Install / Notebooks

Install NumPy and Pandas in a clean Python environment. Pin versions, choose between pip + venv and conda, verify with a tiny smoke test.

NumPy + Pandas — install

EXAMPLE
# ===== 1. Pick a Python distribution =====
# - System Python + venv (most common)
# - pyenv to manage versions
# - conda / mamba (Anaconda) for data-science-heavy work
# - uv (fast Rust-based; recommended in 2026)

# ===== 2. venv + pip (the standard) =====
python -m venv .venv
source .venv/bin/activate         # Windows: .venv\Scripts\activate
pip install --upgrade pip
pip install numpy pandas pyarrow matplotlib

# Pin into requirements.txt:
pip freeze > requirements.txt
# Or manage with pip-tools / poetry / uv for proper lockfiles.

# ===== 3. uv (faster) =====
pip install uv     # or: curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install numpy pandas pyarrow

# ===== 4. conda =====
conda create -n data python=3.11 numpy pandas pyarrow matplotlib
conda activate data

# ===== 5. Verify =====
python - <<'PY'
import numpy as np, pandas as pd
print('numpy', np.__version__)
print('pandas', pd.__version__)
print(pd.DataFrame({'a': [1, 2, 3]}))
PY

# ===== 6. Optional companions =====
pip install jupyterlab seaborn scikit-learn polars duckdb
# JupyterLab: interactive notebooks
# Seaborn: nicer matplotlib charts
# scikit-learn: classical ML
# Polars: very fast Pandas alternative
# DuckDB: SQL on parquet/CSV directly

# ===== 7. Jupyter =====
jupyter lab
# Opens in browser; new notebook -> Python 3.

# ===== 8. Pin via requirements.txt or pyproject.toml =====
# requirements.txt
numpy==1.26.4
pandas==2.2.2
pyarrow==15.0.2

# Install pinned:
pip install -r requirements.txt

# ===== Patterns to internalise =====
# - Always work in a venv (or conda env); never pollute system Python
# - Pin major + minor versions for reproducibility
# - Use pyarrow as the parquet backend for Pandas
# - Use uv when you have it; pip-tools / poetry for stricter lockfiles

# ===== Pitfalls =====
# - 'pip install --user' on a managed Python -> mixed state
# - Mismatched Python + NumPy versions on Apple Silicon
# - Conda + pip in the same env without care
# - No lockfile -> 'works in dev, breaks in CI'

Why it matters

venv + pip (or uv) is the modern install. Pin versions, ship a lockfile, verify with a smoke test. Pandas + NumPy with pyarrow as the parquet backend covers most data work; Polars and DuckDB are excellent companions when scale demands them.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
pip install numpy pandas jupyter
jupyter lab
Try it Yourself »

Discussion

Loading…