import pandas as pd
import numpy as np
import sklearn
print(f"pandas: {pd.__version__}")
print(f"numpy: {np.__version__}")
print(f"sklearn: {sklearn.__version__}")
print("\nAll good! Your Python environment is ready.")Pre-Lab Exercises: Environment Setup
These exercises should be completed before your first lab session. They ensure your environment is ready to work with Python, Git, Docker, and the full course infrastructure.
Where do I run what?
Throughout this course, you will work in three different places. It’s important to know which one to use:
| Where | What | How to open |
|---|---|---|
| System terminal | Git commands, Docker commands, running .py files |
macOS: Terminal app. Windows: PowerShell or CMD. Linux: any terminal emulator. |
| JupyterLab | Interactive notebooks (.ipynb), data exploration, visualizations |
Open your browser at localhost:8888 after starting the environment |
| Text editor / IDE | Writing .py files (API servers, producers, consumers) |
VS Code recommended, or any editor you prefer |
When an exercise says “in the terminal”, it means your system terminal (not JupyterLab’s terminal). When it says “in JupyterLab”, open a new notebook or use the JupyterLab terminal. When it says “create a file”, write it in your editor or use %%file filename.py magic in JupyterLab.
Part 1: Python
Task 1.1 – Check Python version
Open your system terminal and run:
python3 --version
pip --versionYou need Python 3.10 or higher. If you don’t have it, install from python.org.
Task 1.2 – Create a virtual environment
Still in the terminal:
python3 -m venv rta_env
source rta_env/bin/activate # Linux/macOS
# rta_env\Scripts\activate # Windows
pip install --upgrade pip
pip install jupyterlab pandas numpy matplotlib scikit-learn requestsTask 1.3 – Start JupyterLab
jupyter labThis opens JupyterLab in your browser at localhost:8888.
In JupyterLab, create a new Python notebook (click “Python 3” under Notebook) and run:
Part 2: Git
Task 2.1 – Install and configure Git
In your system terminal:
git --version
git config --global user.name "Your Name"
git config --global user.email "your@email.com"Task 2.2 – Create a GitHub account
If you don’t have one yet, go to github.com and create an account.
Task 2.3 – Create your course repository
- On GitHub, click “New repository”
- Name it
RTA_<your_initials>(e.g.,RTA_SZ) - Check “Add a README file”
- Clone it to your computer:
git clone https://github.com/<your_username>/RTA_<your_initials>.git
cd RTA_<your_initials>Task 2.4 – Make your first commit
echo "# Real-Time Analytics - Course Repository" > README.md
git add .
git commit -m "Initial commit"
git push origin mainPart 3: Docker
Task 3.1 – Install Docker
Download and install Docker Desktop from docker.com.
Task 3.2 – Verify installation
In your terminal:
docker --version
docker compose version
docker run hello-worldYou should see “Hello from Docker!” in the output.
Task 3.3 – Run Python in a container
docker run -it python:3.11-slim python -c "print('Hello from Docker!')"Part 4: Course Environment
Task 4.1 – Clone the course infrastructure
This repository contains the full lab environment: JupyterLab, Kafka, Spark, all pre-configured.
git clone -b 2026Redis https://github.com/sebkaz/jupyterlab-project.git
cd jupyterlab-projectTask 4.2 – Start the environment
docker compose up -dWait 1-2 minutes for all services to start, then check:
docker compose psYou should see several containers running (JupyterLab, Kafka, Zookeeper, etc.).
Task 4.3 – Access JupyterLab
Open your browser and go to: http://localhost:8999
password: root
You should see the JupyterLab interface. Create a new notebook and run:
# Run this in a JupyterLab notebook inside the Docker environment
import sys
print(f"Python: {sys.version}")
print(f"Running inside: {sys.prefix}")
print("Course environment is ready!")Task 4.4 – Verify Kafka is running
Open a terminal inside JupyterLab (File > New > Terminal) and run:
kafka-topics.sh --list --bootstrap-server broker:9092If it returns without errors (may show empty list), Kafka is running.
Task 4.5 – Stop the environment
When you’re done:
docker compose downChecklist
Before your first lab, make sure you can:
Submit the link to your GitHub repository via MS Teams.