AI & ML Quick Path

Part 1: The big picture

Set up your laptop for AI and ML in Python and .NET

Learning goal. Install and check a Python and a .NET environment for AI work, run notebooks, use Git, and understand when you need a GPU.

In plain words

You can learn almost all of AI and ML on an ordinary laptop. You need a programming environment, a few libraries and a place to save your work. Python has the largest set of AI libraries: NumPy and pandas (data), scikit-learn (classic ML), PyTorch (deep learning), and libraries for language models. .NET is strong for building business applications: ML.NET (classic ML), TorchSharp (deep learning), ONNX Runtime (run trained models fast), and Microsoft.Extensions.AI (call language models). A virtual environment keeps each Python project's libraries separate. Notebooks (Jupyter, or Polyglot Notebooks in VS Code for C#) let you run code step by step and see results. Git saves every version of your code. A GPU (graphics card) makes deep learning much faster, but it is only needed for bigger neural networks; small models train fine on a CPU, and you can rent GPUs in the cloud when you need them.

Diagram Python and .NET tools for the same jobs

Python

  • Data NumPy and pandas
  • Classic ML scikit-learn
  • Deep learning PyTorch
  • Language models Libraries for language models

.NET

  • Classic ML ML.NET
  • Deep learning TorchSharp
  • Run trained models fast ONNX Runtime
  • Language models Microsoft.Extensions.AI

Both are covered in every lesson of this guide.

Diagram Your working setup
  1. Data storeGitSaves every version of your code
  2. ProcessNotebooksRun code step by step and see results
  3. ModelLibraries in a virtual environmentKept separate for each Python project
  4. InputPython and .NETInstalled on an ordinary laptop

Each layer sits on the one below it.

Diagram CPU or GPU

CPU

  • Enough for Classic ML and small neural networks

GPU

  • Helps with Much faster deep learning on bigger neural networks
  • How to get one Rent in the cloud when you need it

Real-world example

A data team gives every new engineer a one-page setup script: create a virtual environment, install pinned library versions from requirements.txt, run a check script, open the starter notebook. Everyone gets identical results, and "it works on my machine" problems disappear.

Diagram The team setup script
  1. ProcessCreate a virtual environmentOne per project
  2. Data storeInstall pinned librariesFrom requirements.txt
  3. ProcessRun a check scriptConfirms the setup works
  4. OutputOpen the starter notebookSame results for everyone

How it works

  1. Install Python 3.10 or newer and the .NET SDK (version 8 or newer) and VS Code.
  2. Python: create a virtual environment and install libraries; record them in requirements.txt.
  3. .NET: create a project with dotnet new console and add NuGet packages.
  4. Run a check script in each language.
  5. Put the project in Git; never commit passwords or API keys.
  6. Optional: install a local model runner (such as Ollama) to run language models on your own machine.
Diagram Setup steps for each language

Python

  1. InputInstall Python 3.10 or newerAnd VS Code
  2. ProcessCreate a virtual environmentInstall libraries
  3. Data storeRecord requirements.txtPinned library versions
  4. OutputRun the check scriptPython environment check

.NET

  1. InputInstall the .NET SDKVersion 8 or newer
  2. Processdotnet new consoleCreate the project
  3. Data storeAdd NuGet packagesLibraries for the project
  4. OutputRun the check script.NET environment check

Python example

Shell — Terminal (macOS/Linux; on Windows use .venv\Scripts\activate)
python -m venv .venv
source .venv/bin/activate
pip install numpy pandas scikit-learn jupyter
pip freeze > requirements.txt
jupyter notebook
Python — check environment (quickpath.py env)
import platform, os, numpy as np, pandas as pd, sklearn
print(f"Python {platform.python_version()} | CPU cores: {os.cpu_count()}")
print(f"numpy {np.__version__} | pandas {pd.__version__} | scikit-learn {sklearn.__version__}")
try:
    import torch
    print(f"PyTorch {torch.__version__} | GPU available: {torch.cuda.is_available()}")
except ImportError:
    print("PyTorch not installed (needed only for deep-learning lessons)")
Output — Output on the machine that built this guide (executed)
Python 3.13.18 on Linux | CPU cores: 2
numpy 2.5.3 | pandas 3.0.5 | scikit-learn 1.9.1
PyTorch not installed (needed only for deep-learning lessons)

Your versions will differ; that is fine. When you reach the deep-learning lessons, install PyTorch using the command generator on its official site, choosing your operating system and whether you have an NVIDIA GPU.

.NET (C#) example

Shell — Terminal
dotnet new console -n AiStarter
cd AiStarter
dotnet add package Microsoft.ML
dotnet add package Microsoft.Extensions.AI
dotnet run
C# — Program.cs (environment check)
using System.Runtime.InteropServices;
Console.WriteLine($".NET {Environment.Version} on {RuntimeInformation.OSDescription}");
Console.WriteLine($"CPU cores: {Environment.ProcessorCount}");
Console.WriteLine($"ML.NET loaded: {typeof(Microsoft.ML.MLContext).Assembly.GetName().Version}");

For C# notebooks, install the Polyglot Notebooks extension in VS Code. For deep learning in .NET, add TorchSharp-cpu (or the CUDA build if you have an NVIDIA GPU).

Maths behind it

  • None for setup. GPUs speed up linear algebra (matrix multiplication), which is the core operation of neural networks.

Common mistakes

  • Installing libraries globally, then breaking one project while fixing another.
  • Committing API keys to Git. Use environment variables or .NET user secrets.
  • Buying an expensive GPU before you need one. Learn first; rent GPU time for big jobs.
Diagram Global install or virtual environment

Libraries installed globally

  • Result Fixing one project can break another

One virtual environment per project

  • Result Each project keeps its own library versions
  • Bonus Setup can be recreated from requirements.txt

Why each project gets its own environment.

Diagram Keeping API keys out of Git
  1. RiskAPI keyNever put it in code
  2. Data storeEnvironment variable or .NET user secretKept outside the repository
  3. OutputGit repositoryContains no passwords or keys

Quick check

  1. Why use a virtual environment in Python?

    Show answer

    Each project gets its own library versions, so projects do not break each other and the setup can be recreated from requirements.txt.

  2. Name one .NET library for classic ML and one for running trained models fast.

    Show answer

    ML.NET for classic ML; ONNX Runtime for fast inference of trained models.

  3. Do you need a GPU to start learning?

    Show answer

    No. Classic ML and small neural networks run on a CPU; rent a GPU later for larger deep-learning work.

Completion

Evidence of completion. Both environment checks run on your machine, a Git repository with your first notebook, and a note of whether your laptop has a usable GPU.

Saved in this browser only. See all progress.