Setting Up Your AI Environment
Before you can build AI models, you need the right tools installed and ready to go. This lesson covers everything you need: which libraries matter, how to install them and the recommended environment for running your code.
The Core Libraries
Every AI and data science project in Python relies on a small set of foundational libraries. You will use these in every single project from here forward.
NumPy NumPy stands for Numerical Python. It provides the array data structure that everything else in the AI ecosystem is built on. If you want to do any maths with large amounts of data, you use NumPy.
Pandas Pandas gives you the DataFrame, a table-like structure for loading, cleaning and analysing data. It is how data scientists interact with spreadsheets, CSV files and databases inside Python.
Matplotlib Matplotlib is the foundation of data visualisation in Python. It lets you create line charts, bar charts, scatter plots, histograms and more with just a few lines of code.
Seaborn Seaborn is built on top of Matplotlib and makes statistical plots much easier to create. It handles the styling and layout automatically so your charts look professional out of the box.
scikit-learn scikit-learn (imported as sklearn) is the most widely used machine learning library in the world. It contains implementations of dozens of algorithms along with tools for evaluating and improving them. You will use this heavily in later courses.
Your Environment Options
Option 1: Google Colab (Recommended)
Google Colab is a free, browser-based notebook environment provided by Google. It requires no installation, runs in your browser and comes with all the major AI libraries pre-installed.
Why Colab is the right choice for this course:
- No setup required. Open a browser and start coding immediately.
- Free GPU access. When you need to train deep learning models later, Colab provides free GPU time.
- Everything pre-installed. NumPy, Pandas, Matplotlib, Seaborn, scikit-learn, TensorFlow and PyTorch are all ready to use.
- Saves to Google Drive. Your notebooks are automatically saved.
- Works on any device. No powerful computer required.
To get started: go to colab.research.google.com, sign in with a Google account and click "New notebook".
Option 2: Local Installation with pip
If you prefer to work locally, you can install everything with pip. Open your terminal and run:
pip install numpy pandas matplotlib seaborn scikit-learn jupyter
Then launch Jupyter Notebook:
jupyter notebook
This opens a browser tab where you can create and run notebooks.
Option 3: Anaconda
Anaconda is a Python distribution that comes bundled with hundreds of data science libraries including all of the above. It is a larger download (around 3 GB) but gives you a complete environment in one installer.
Download from anaconda.com. After installation, open Anaconda Navigator and launch Jupyter Notebook from there.
Recommendation: Use Google Colab. It is free, requires no installation and works on any device. You can switch to local development later if you prefer.
What is a Jupyter Notebook?
Whether you use Colab or a local installation, you will be working in Jupyter notebooks. A notebook is a document made up of cells. Each cell can contain either code or text.
When you run a code cell, the output appears directly below it. This makes it easy to experiment, see results immediately and document your thinking alongside your code.
The two main types of cells:
- Code cells: Contain Python code. Press Shift+Enter to run them.
- Markdown cells: Contain formatted text. Used for documentation and explanation.
Verifying Your Installation
Once you have your environment open, run the following code in a cell to confirm everything is installed:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
print("NumPy version:", np.__version__)
print("Pandas version:", pd.__version__)
print("Matplotlib version:", plt.matplotlib.__version__)
print("Seaborn version:", sns.__version__)
print("\nAll libraries imported successfully!")
If you see version numbers printed without any errors, your environment is ready.
A Note on Import Conventions
You will notice we imported libraries with short aliases: np for NumPy, pd for Pandas, plt for Matplotlib's pyplot module. These are universal conventions in the data science community. Every tutorial, book and Stack Overflow answer uses them. You should too.
import numpy as np # Always np
import pandas as pd # Always pd
import matplotlib.pyplot as plt # Always plt
import seaborn as sns # Always sns
Key Takeaway: Google Colab is the fastest way to start working with AI libraries in Python. It is free, requires no installation and has everything pre-installed. Open colab.research.google.com, create a new notebook and run your first import.
Reflection: What environment will you use for this course and why? If you chose Colab, open it now and verify that NumPy, Pandas, Matplotlib and Seaborn all import without errors.