Machine Learning Setup: Python and Jupyter
Machine Learning Setup: Python and Jupyter
Every machine learning project starts with the same boring but vital step: a working environment. Python is the standard language for ML, and Jupyter is the notebook format you will live in while exploring data.
Install Python and a Virtual Environment
Install a recent Python version and create an isolated virtual environment for the project. A virtual environment prevents the thousand tiny version conflicts that break real projects.
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install numpy pandas scikit-learn jupyterlab matplotlibOn Windows the activation script is inside the .venv scripts folder. Commit a requirements file so colleagues and future-you can reproduce the setup.
Start Jupyter
Run jupyter lab in the project folder. A notebook holds cells of Python, rendered markdown, and charts. Work interactively: run one cell, inspect the result, adjust, and rerun. This loop is the core of prototyping ML models.
The Libraries at a Glance
- NumPy: fast array math.
- pandas: tabular data with labeled rows and columns.
- scikit-learn: models, preprocessing, and evaluation.
- Matplotlib: charts for exploring results.
Verify the Setup
import numpy as np
import pandas as pd
import sklearn
print(np.__version__)
print(pd.__version__)
print(sklearn.__version__)If these print clean versions, your machine is ready. This check catches broken installs in five seconds instead of after an hour of debugging.
Key Points
- Use an isolated virtual environment per project.
- Jupyter notebooks support interactive exploration.
- NumPy, pandas, and scikit-learn cover most workflows.
- Verify the stack with a version check first.