AI Development Environment Setup: Anaconda, Jupyter, and GPU Acceleration (Lecture 4)

In this lecture, we’ll set up a stable AI development environment for Machine Learning and Deep Learning projects. You’ll learn how to install Anaconda, run Jupyter Notebook, and configure GPU acceleration with CUDA and cuDNN.


Table of Contents

{% toc %}


1) Why Environment Setup Matters

A well-configured environment prevents common issues such as:

  • Library version conflicts
  • Slow training due to CPU-only execution
  • Non-reproducible results across team members

Goals:

  1. Create isolated Python environments
  2. Install essential ML/DL libraries
  3. Enable GPU acceleration
  4. Set up a convenient coding workspace

2) Essential Tools Overview

2.1 Anaconda

  • Manages Python versions and packages in isolated environments.
  • Avoids dependency conflicts between projects.

2.2 Jupyter Notebook

  • Interactive browser-based Python IDE.
  • Perfect for experiments, data analysis, and sharing code.

2.3 GPU (CUDA + cuDNN)

  • NVIDIA GPUs drastically speed up training.
  • Requires correct CUDA Toolkit and cuDNN installation.

3) Installing Anaconda and Creating an Environment

Download Anaconda: https://www.anaconda.com/download

  1. Create a new virtual environment:

    1
    
    conda create -n ai_env python=3.10
    
  2. Activate the environment:

    1
    
    conda activate ai_env
    
  3. Install essential packages:

    1
    2
    
    conda install numpy pandas matplotlib scikit-learn
    pip install tensorflow torch
    

4) Installing and Running Jupyter Notebook

  1. Install Jupyter:

    1
    
    conda install jupyter
    
  2. Launch Jupyter:

    1
    
    jupyter notebook
    
  3. Open the provided URL (e.g., http://localhost:8888) in your browser.

  4. Create a new Python notebook and start coding.


5) Configuring GPU (NVIDIA Only)

5.1 Install CUDA Toolkit & cuDNN

5.2 Verify GPU Availability (TensorFlow Example)

1
2
3
import tensorflow as tf
print("TensorFlow version:", tf.__version__)
print("GPU available:", tf.config.list_physical_devices('GPU'))

Example Output

1
2
TensorFlow version: 2.15.0
GPU available: [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

6) Lab: Environment Verification Script

Run the following in Jupyter Notebook to confirm your setup:

1
2
3
4
5
6
7
8
import numpy as np
import tensorflow as tf
import torch

print("NumPy version:", np.__version__)
print("TensorFlow GPU:", tf.config.list_physical_devices('GPU'))
print("PyTorch GPU:", torch.cuda.is_available())
print("PyTorch CUDA version:", torch.version.cuda)

Expected Output

1
2
3
4
NumPy version: 1.26.4
TensorFlow GPU: [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
PyTorch GPU: True
PyTorch CUDA version: 12.1

7) Key Takeaways

  • Anaconda keeps Python environments isolated and conflict-free.
  • Jupyter Notebook is ideal for ML/DL experiments.
  • GPU acceleration significantly boosts training speed.
  • Always verify your setup after installation.

8) What’s Next?

In Lecture 5, we’ll cover Data Preprocessing and Visualization—handling missing values, detecting outliers, normalizing data, and creating visualizations.