Module 01 Beginner 15 min read

The ML Ecosystem

Set up a professional ML workspace with Python, Conda, Pip, and JupyterLab — reproducible environments from day one.

Updated 2025 · Edit on GitHub

Why Your Environment Matters

Before writing a single line of ML code, you need a reproducible, isolated workspace. Dependency hell — where two projects need incompatible library versions — kills productivity fast. Setting up properly once saves dozens of hours later.

Python for ML

Python dominates ML because of its ecosystem, not its speed. The heavy computation in NumPy, PyTorch, and TensorFlow runs in optimised C/Fortran under the hood — Python is just the glue. Stick to Python 3.10+.

🌿
Why not R, Julia, or C++? R has better statistics tooling but poorer deployment story. Julia is fast but has a smaller ecosystem. C++ is used inside ML libraries, not on top of them. Python wins on breadth.

Conda: Environment & Package Manager

Conda manages both Python versions and non-Python dependencies (like CUDA for GPU support). Each project gets its own isolated environment.

Bash
# Install Miniconda (lightweight Conda) from https://docs.conda.io

# Create a dedicated ML environment
conda create -n zerotoml python=3.11 -y
conda activate zerotoml

# Install the core ML stack
conda install numpy pandas matplotlib seaborn scikit-learn jupyter -y
pip install xgboost lightgbm catboost plotly

# Save your environment so teammates can replicate it exactly
conda env export > environment.yml

# Anyone can recreate it with:
conda env create -f environment.yml

Pip: When to Use It

Pip is Python's built-in package manager. Use Conda for environment management and Pip for packages not in the Conda channel. Always activate your Conda environment first.

Bash
# Check installed packages
pip list

# Install a specific version
pip install scikit-learn==1.4.0

# Install from a requirements file
pip install -r requirements.txt

# Freeze current environment (pip only)
pip freeze > requirements.txt
⚠️
Never mix Conda and Pip carelessly. Install everything you can with Conda first, then use Pip for what's missing. Mixing can break dependency resolution. Always use Pip inside an active Conda environment, never at system level.

Jupyter Notebooks & JupyterLab

Jupyter notebooks (.ipynb) interleave code, outputs, markdown, and plots in one document. They're the standard tool for exploration, experimentation, and teaching ML.

Bash
# Launch classic Notebook
jupyter notebook

# Launch JupyterLab (modern, recommended)
jupyter lab

# Register your Conda env as a Jupyter kernel
pip install ipykernel
python -m ipykernel install --user --name zerotoml --display-name "ZeroToML"
Shift+EnterRun current cell and move to next.
Ctrl+EnterRun current cell, stay.
B / AInsert cell Below / Above (command mode).
M / YSwitch cell to Markdown / Code.
DDDelete current cell.

Project Structure

A clean folder layout prevents chaos on longer projects:

Bash
my-ml-project/
├── data/
│   ├── raw/          # original, never-modified data
│   └── processed/    # cleaned, feature-engineered data
├── notebooks/        # exploration & EDA notebooks
├── src/              # reusable Python modules
│   ├── features.py
│   └── models.py
├── models/           # saved model artefacts (.pkl, .joblib)
├── reports/          # generated figures, reports
├── environment.yml
└── README.md
💡
Treat raw data as read-only. Never overwrite it. All transformations produce new files in data/processed/. This way you can always re-run the pipeline from scratch.

VS Code as a Jupyter IDE

VS Code with the Jupyter and Python extensions gives you the best of both worlds: notebook interactivity with full IDE features (intellisense, debugging, git). Install the extensions and open any .ipynb file directly.

Summary

  • Use Conda to create isolated environments per project. Export with conda env export.
  • Use Pip inside Conda for packages not on the Conda channel.
  • JupyterLab is the recommended interface for exploration and prototyping.
  • Keep raw data read-only. Structure projects consistently from day one.