4ml

Since December 2018 · Updated June 2026

A Practical Python Environment for Artificial Intelligence

A practical installation and tooling guide for AI, ML, CV and NLP in Python
written for AI scientists, students and lab teams.

By Warith Harchaoui, Mohamed Chelali, Matias Tassano, Pierre-Louis Antonsanti, Bachir Zerroug and Edmond Jacoupeau.

1. Introduction

This page is a practical setup guide: how to choose and install a sane Python environment for doing real work in Machine Learning, Computer Vision, Sound Processing and Natural Language Processing (AI / ML / CV / NLP). It is aimed at students, researchers, engineers and practitioners, with open-source tools that are widely used, well maintained and useful in practice. It reflects what I rely on day to day; it is not an exhaustive benchmark of every framework.

Two hardware paths matter today:

This page has been used in the MAP5 lab in Applied Mathematics to conduct research in AI, ML, CV and NLP in Python. Please feel free to contact Warith Harchaoui for improvements and suggestions.

2. Programming in AI

Depending on the decade, the ML community has moved from Java to MATLAB to Python. Trillion-dollar companies have chosen Python, and the research community has followed with funding and tooling. We recommend Python for your ML projects to match the scientific and industrial trend — not as a personal taste but as a pragmatic default. Teams on R or Java can still ship through ONNX-R and DL4J; Rust is gaining ground — see "Are we learning yet?".

Recommended toolboxes

Ordered chronologically by the first release of the lead tool — you can read the list as a short history of the field.

AI helpers

Practical Python utility libraries the author maintains on GitHub — the full index lives at harchaoui.org/warith/ai-helpers. Each one wraps a specific corner of the AI / media stack so you do not re-implement the same plumbing in every project.

Model serving and deployment

Model serving hosts ML models (cloud or on-premises) and exposes them via an API so that applications can integrate AI into their flow. For cross-language compatibility, ONNX is both a model file format and a deployment framework, backed by open-source contributions plus Microsoft and the Linux Foundation AI. Prototype in Python, deploy via ONNX format and ONNX Runtime for C / C++, C#, Java, JavaScript and Objective-C.

For performance-critical code, the well-trodden path is still C / C++ called from a higher-level language. For Python, I have the best experience with pybind11 (Meta used it for fastText). Cython is respected thanks to scikit-learn; Numba is a pleasant just-in-time alternative for hot loops. Apple's coremltools let you tap the Neural Engine from Python at inference time.

Historical note. Older frameworks and GPU abstraction layers such as Apache MXNet, PlaidML and DeepCL played a role in the evolution of deep learning tooling, but I would not recommend starting a new project with them today — MXNet in particular has been retired into the Apache Attic.

3. Installation

For optimal performance, we recommend Ubuntu with NVIDIA GPU acceleration, optionally controlled remotely from a Mac. For prototyping on small datasets and for iteration, we recommend Google Antigravity for programming on any platform. The environment name is env4ml; Python version is 3.12 (PyTorch and most maintained packages now support 3.12 by default).

Ubuntu (22.04 LTS or higher)

  1. Install Miniconda:

    mkdir -p ~/miniconda3
    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
    bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
    rm -rf ~/miniconda3/miniconda.sh
    ~/miniconda3/bin/conda init bash

    Close and reopen the terminal, then create the environment:

    ENV=env4ml
    conda update -y -n base -c defaults conda
    conda create -y -n $ENV python=3.12
    conda activate $ENV
    conda install -y pip
    pip install scikit-learn pandas matplotlib seaborn
  2. NVIDIA driver and CUDA — follow the Google Cloud instructions on your local machine. Mandatory for NVIDIA acceleration.

  3. Activate the environment for each session:

    ENV=env4ml
    conda activate $ENV

macOS (Sonoma 14 or higher, Apple Silicon)

On Apple Silicon Macs the situation is much better than it used to be. PyTorch can use Apple's Metal Performance Shaders backend through the mps device, which makes local experimentation and prototyping pleasant. Apple also develops MLX, a NumPy-like array framework with autodiff designed for ML research on Apple Silicon. These are useful, especially for local work; for heavy training, CUDA on NVIDIA GPUs is still the reference.

  1. Command-line tools and Homebrew:

    xcode-select --install
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install wget
  2. Install Miniconda (Apple Silicon, arm64):

    mkdir -p ~/miniconda3
    curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh
    bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
    rm -rf ~/miniconda3/miniconda.sh
    ~/miniconda3/bin/conda init zsh

    Close and reopen the terminal, then create the environment:

    ENV=env4ml
    conda update -y -n base -c defaults conda
    conda create -y -n $ENV python=3.12
    conda activate $ENV
    conda install -y pip
    pip install scikit-learn pandas matplotlib seaborn

Windows (10 or higher)

  1. Install Miniconda:

    curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
    start /wait "" miniconda.exe /S
    del miniconda.exe
  2. Create the environment:

    set ENV=env4ml
    conda update -y -n base -c defaults conda
    conda create -y -n %ENV% python=3.12
    conda activate %ENV%
    conda install -y pip
    pip install scikit-learn pandas matplotlib seaborn

Web browser tools

  • Jupyter — local in-browser environment for demos, hands-on workshops and quick prototyping. pip install jupyter, then jupyter notebook.
  • Google Colab — Jupyter-style, running on Google's GPUs / TPUs.
  • Streamlit, Gradio and Taipy — Python-first auto-form generators for ML demos and small data apps. Excellent for the 80% case; opinionated about visual style. If you need the result to look like your app instead of a Streamlit / Gradio / Taipy app, see section 5 below.

4. AI coding agents — a new abstraction level

Programming has always moved by adding abstraction layers. Machine code gave way to assembly. Assembly gave way to C. C gave way to Python, JavaScript, Rust. Each new level let programmers express more intent and delegate more mechanism to a tool: the compiler. Large language models add the next layer — natural language as the source artifact, with code as a compiled output.

“The hottest new programming language is English.”
Andrej Karpathy, tweet, January 24, 2023.

That is the optimist's framing. The same observation, from the other side of the abstraction stack, comes from the creator of Linux:

“AI is a great new tool, but it's a tool, and when I see people saying, ‘Hey, 99% of our code is written by AI,’ I literally get angry, because those same people — I can pretty much guarantee — that 100% of their code is written by compilers.”
— Linus Torvalds, keynote at the Open Source Summit North America, Minneapolis, May 2026. Video clip.

Both quotes are right at the same time. Karpathy is naming the new floor — most people will reach a useful program by writing English instead of Python. Torvalds is naming the ceiling — the engineer who understands what the compiler (or the model) produced is still the one who can debug, optimize and ship it. For an ML student today, the practical synthesis is: treat AI coding agents as the next compiler, write your intent clearly, and read the output critically.

Two coding agents we recommend

Claude Code

Anthropic's official CLI agent. Reads your repo, runs commands, edits files and follows project-specific skills declared in ~/.claude/skills/. Strong at code review, refactors, end-to-end debugging, and multi-file edits.

OpenCode

Open-source terminal coding agent that runs Claude, GPT or local models behind the same UX. Reads the same skill format from ~/.opencode/skills/. Pick this when you want to avoid vendor lock-in or use a local model for sensitive code.

5. Front — vanilla JS + Tailwind, with a CLI → GUI flagship

Most ML students and small lab teams hit the same wall: you have a working Python CLI, your supervisor wants a web UI to demo it, and nobody on the team wants to learn React. The default answers (Gradio, Streamlit, Taipy, Tauri) each work for a slice of the problem but force their look and their runtime on the result.

Front is an open-source Claude / OpenCode skill that constrains the agent to one frontend stack — vanilla JavaScript, Tailwind CSS, Montserrat (or Inter) — and gives it a curated design system. Asking the agent to "wrap this CLI in a GUI" produces a single-page index.html + app.js + Tailwind config that maps each argparse / click flag to the right form control and streams the CLI's output to a log panel. No framework lock-in, no Python runtime, no "Gradio look" — plain HTML you can edit.

Install with Claude Code

git clone https://github.com/warith-harchaoui/front.git
mkdir -p ~/.claude/skills
cp -r front/front-ui      ~/.claude/skills/front-ui
cp -r front/front-cli-gui ~/.claude/skills/front-cli-gui
cp -r front/front-publish ~/.claude/skills/front-publish
cp -r front/front-a11y    ~/.claude/skills/front-a11y

Or OpenCode

mkdir -p ~/.opencode/skills
cp -r front/front-* ~/.opencode/skills/

The repo: github.com/warith-harchaoui/front — public domain (Unlicense).

Why this matters for ML practitioners

6. Conclusion

This page outlines installation procedures for Artificial Intelligence development in Python and explains where AI coding agents and front-end skills fit on top of the stack. We recommend beginners explore the free Kaggle courses for hands-on practice.

Our choice of conda + pip is pragmatic:

Create the environment with conda, install with both as needed. To export and recreate:

conda list --export > requirements.txt
conda create --name ENVNAME --file requirements.txt

If something goes wrong and you need to start over:

cd ~
rm -rf miniconda*
rm -rf .conda*