Awesome Python AI: The Best Python Libraries for AI, Machine Learning and LLMs, by Task
Awesome Python AI is a curated list of the Python libraries that matter for artificial intelligence and machine learning in 2026, organized by the task you are trying to do: data wrangling, classical machine learning, deep learning, large language models (LLMs), fine-tuning, AI agents, RAG and vector search, document parsing, evaluation, computer vision, speech, time series, MLOps and more. Each entry says what the library is best at, with a “start here” pick per category and comparison tables for the crowded areas. It is for Python developers, data scientists and ML engineers choosing tools for a real project.
Last reviewed: December 2026. Every GitHub link was checked on the review date; archived projects were removed or flagged.
Table of contents
- How to use this list
- Quick picks
- Data and numerical computing
- Classical machine learning
- AutoML and hyperparameter tuning
- Deep learning frameworks
- Training utilities and performance
- LLM client SDKs
- Running LLMs locally and serving them
- Structured output and prompting
- Fine-tuning LLMs
- AI agent frameworks
- Model Context Protocol (MCP)
- RAG frameworks and vector search
- Document parsing and web data for LLMs
- Evaluation and observability
- Natural language processing
- Computer vision
- Speech and audio
- Image generation
- Time series forecasting
- Reinforcement learning and robotics
- Graph machine learning
- Explainability and interpretability
- Data labeling, data quality and synthetic data
- MLOps, experiment tracking and deployment
- Demos, apps and notebooks
- Visualization
- Python tooling for AI projects
- Starter stacks
- FAQ
- Where to go next
- Contributing
- More free resources
How to use this list
- Every category starts with a Start here pick: the library most people should try first, and why.
- Entries are libraries you
pip installand use from Python. Large standalone apps (chat UIs, servers) are mostly left out. - Licenses matter for commercial work. Entries note copyleft licenses (GPL, AGPL, LGPL) because they can affect how you ship.
- Inclusion criteria: actively maintained (commits in the last year), widely used or clearly best in class for a niche, and documented.
Quick picks
If you only read one table:
| Task | Pick | Runner-up |
|---|---|---|
| Tabular data | pandas | Polars (faster, lazy queries) |
| Classical ML on tables | scikit-learn | XGBoost / LightGBM for boosting |
| Deep learning | PyTorch | JAX for research at scale |
| Pretrained models | Hugging Face Transformers | timm for vision backbones |
| Calling hosted LLMs | The provider’s official SDK | LiteLLM for one API over many providers |
| Running LLMs locally | Ollama Python client | llama-cpp-python |
| Serving LLMs on GPUs | vLLM | SGLang |
| Fine-tuning LLMs | TRL + PEFT | Unsloth (faster, less memory) |
| Agents | Pydantic AI or the OpenAI Agents SDK | LangGraph for complex stateful graphs |
| RAG | LlamaIndex | Haystack |
| Vector search in-process | FAISS | LanceDB, Chroma |
| PDF to Markdown | Docling | Marker, MarkItDown |
| LLM evaluation | DeepEval or Inspect | Ragas for RAG metrics |
| Tracing LLM apps | Langfuse | Arize Phoenix, Opik |
| Object detection | Ultralytics | supervision for post-processing |
| Speech-to-text | faster-whisper | WhisperX (word timestamps, diarization) |
| Forecasting | statsforecast | Darts, sktime |
| Experiment tracking | MLflow | Weights & Biases |
| Demo UI | Gradio | Streamlit |
Data and numerical computing
Start here: pandas for everyday tabular work; switch to Polars when data gets big or pandas gets slow.
| Library | Use it for | Notes |
|---|---|---|
| NumPy | N-dimensional arrays and vectorized math | The foundation almost every other library builds on |
| pandas | DataFrames: loading, cleaning, joining, grouping | Huge ecosystem and documentation |
| Polars | Fast DataFrames with a lazy query engine | Written in Rust, multi-threaded, great for larger-than-memory work |
| DuckDB | SQL on local files and DataFrames | Query Parquet and CSV in place; integrates with pandas and Polars |
| Apache Arrow (PyArrow) | Columnar in-memory format, Parquet I/O | The interchange layer between pandas, Polars, DuckDB and Spark |
| SciPy | Optimization, statistics, signal processing, sparse matrices | Scientific algorithms on top of NumPy |
| statsmodels | Statistical models and tests with readable summaries | Regression, GLMs, hypothesis tests, classical time series |
Classical machine learning
Start here: scikit-learn. Its consistent fit / predict API, pipelines and model selection tools are the baseline for any tabular problem.
| Library | Use it for | Notes |
|---|---|---|
| scikit-learn | Classification, regression, clustering, preprocessing, pipelines, cross-validation | The standard; learn it first |
| XGBoost | Gradient-boosted trees | Strong default for tabular competitions; GPU support |
| LightGBM | Fast gradient boosting on large datasets | Histogram-based, low memory |
| CatBoost | Boosting with native categorical features | Good results with little tuning |
| imbalanced-learn | Resampling for imbalanced classes (SMOTE and more) | scikit-learn compatible |
Gradient boosting libraries compared:
| XGBoost | LightGBM | CatBoost | |
|---|---|---|---|
| Speed on large data | Fast | Usually fastest | Fast, slower training on CPU |
| Categorical features | Supported natively in recent versions | Supported natively | Best native handling |
| Tuning effort | Medium | Medium | Low |
| GPU training | Yes | Yes | Yes |
AutoML and hyperparameter tuning
Start here: Optuna for tuning any model; AutoGluon when you want a strong tabular model with almost no code.
| Library | Use it for | Notes |
|---|---|---|
| Optuna | Hyperparameter search with pruning | Define-by-run API, works with any framework |
| AutoGluon | AutoML for tabular, text, image and time series | Strong stacked ensembles out of the box |
| FLAML | Fast, low-cost AutoML and tuning | Lightweight, from Microsoft Research |
| PyCaret | Low-code ML experiments | Compare many models in a few lines |
Deep learning frameworks
Start here: PyTorch. Most research code, pretrained models and tutorials use it.
| Library | Use it for | Notes |
|---|---|---|
| PyTorch | Building and training neural networks | Dominant framework in research and industry |
| JAX | Composable transforms: grad, jit, vmap, sharding |
NumPy-like API compiled with XLA; popular for large-scale research |
| Flax | Neural network library for JAX | Includes the newer NNX API |
| Equinox | Neural networks in JAX as PyTrees | Minimal and elegant |
| Keras | High-level deep learning API | Keras 3 runs on JAX, TensorFlow or PyTorch backends |
| TensorFlow | End-to-end ML platform | Still common in production and on mobile via LiteRT |
| MLX | Array framework for Apple silicon | Unified memory, NumPy-like API, from Apple ML research |
| tinygrad | Small deep learning framework | Readable codebase, many hardware backends |
| fastai | High-level training on top of PyTorch | Good defaults; pairs with the fast.ai course |
Training utilities and performance
Start here: Hugging Face Accelerate to run the same training loop on CPU, one GPU or many.
| Library | Use it for | Notes |
|---|---|---|
| PyTorch Lightning | Structured training loops, multi-GPU, logging | Removes boilerplate |
| Accelerate | Device-agnostic and distributed training | Minimal changes to plain PyTorch code |
| DeepSpeed | Training very large models (ZeRO, offloading) | Memory optimizations for multi-GPU |
| torchao | Quantization and sparsity for PyTorch | Native PyTorch model optimization |
| Optimum | Hardware-specific optimization of Transformers models | Export and accelerate on many backends |
| ONNX | Portable model format | Export once, run in many runtimes |
| safetensors | Safe, fast tensor serialization | Replaces pickle-based checkpoints |
| bitsandbytes | 8-bit and 4-bit quantization, 8-bit optimizers | Powers QLoRA |
| timm | Hundreds of pretrained vision backbones | Consistent API for image models |
LLM client SDKs
Start here: the official SDK of the provider you use. Add LiteLLM if you need to switch between providers.
| Library | Use it for | Notes |
|---|---|---|
| openai-python | OpenAI API, and any OpenAI-compatible endpoint via base_url |
Also used for local servers like vLLM and Ollama |
| anthropic-sdk-python | Claude API | Messages, tool use, streaming, batches |
| google-genai | Gemini API and Vertex AI | Google’s current unified Python SDK |
| LiteLLM | One interface over 100+ LLM providers, plus a proxy server | Cost tracking, fallbacks, load balancing |
| huggingface_hub | Download models and datasets, call inference providers | hf CLI included |
| tiktoken | Fast BPE tokenizer for OpenAI models | Count tokens before sending |
# The same client works for OpenAI and many OpenAI-compatible servers
from openai import OpenAI
client = OpenAI() # or OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
resp = client.chat.completions.create(
model="<model-id>",
messages=[{"role": "user", "content": "One tip for writing clean Python?"}],
)
print(resp.choices[0].message.content)
Running LLMs locally and serving them
Start here: Ollama with its Python client on a laptop; vLLM on a GPU server.
| Library | Use it for | Notes |
|---|---|---|
| ollama-python | Python client for a local Ollama server | Simplest way to script local models |
| llama-cpp-python | Python bindings for llama.cpp, GGUF models | Runs on CPU, Apple Metal and CUDA |
| lmstudio-python | Python SDK for LM Studio | Load and query models running in LM Studio |
| MLX LM | Run and fine-tune LLMs on Apple silicon | Quantization and LoRA included |
| vLLM | High-throughput LLM serving | PagedAttention, continuous batching, OpenAI-compatible server |
| SGLang | Fast serving for LLMs and VLMs | Strong at structured and multi-call workloads |
| TensorRT-LLM | Optimized inference on NVIDIA GPUs | Best raw performance on NVIDIA hardware, more setup |
| Ollama | llama.cpp | vLLM | SGLang | |
|---|---|---|---|---|
| Best for | Laptops, quick local use | CPU, edge, Apple silicon | Multi-user GPU serving | GPU serving with complex prompts |
| Model format | GGUF (managed for you) | GGUF | Hugging Face weights, many quantizations | Hugging Face weights |
| OpenAI-compatible API | Yes | Yes (llama-server) |
Yes | Yes |
| Setup effort | Lowest | Low | Medium | Medium |
Structured output and prompting
Start here: Instructor or Pydantic AI if you want typed objects back from an API model; Outlines for guaranteed structure with local models.
| Library | Use it for | Notes |
|---|---|---|
| Instructor | Pydantic models as LLM output, with validation and retries | Works with most providers |
| Outlines | Constrained generation: JSON schema, regex, grammars | Structure guaranteed at decoding time |
| Guidance | Interleave generation and control flow with constraints | Fine-grained control for local models |
| DSPy | Programming, not prompting: declarative modules and optimizers | Optimizes prompts and few-shot examples against a metric |
| LangExtract | Extract structured information from long text with source grounding | Maps each extraction back to its source span |
| Pydantic | Data validation with type hints | The schema layer under most of the tools above |
# Instructor: get a validated Pydantic object instead of free text
import instructor
from pydantic import BaseModel
class Invoice(BaseModel):
vendor: str
total: float
currency: str
client = instructor.from_provider("openai/<model-id>")
invoice = client.chat.completions.create(
response_model=Invoice,
messages=[{"role": "user", "content": "ACME Corp invoice, total due 1,250.00 EUR"}],
)
print(invoice.total)
Fine-tuning LLMs
Start here: TRL with PEFT (LoRA) for a standard, well-documented path; Unsloth when GPU memory or time is tight.
| Library | Use it for | Notes |
|---|---|---|
| TRL | SFT, DPO, GRPO and other post-training methods | Hugging Face’s reference trainers |
| PEFT | LoRA, QLoRA and other parameter-efficient methods | Train adapters instead of full weights |
| Unsloth | Faster fine-tuning with lower memory | Popular for single-GPU and Colab fine-tuning |
| Axolotl | Config-driven fine-tuning pipelines | YAML configs for many models and methods |
| LlamaFactory | Fine-tune 100+ models with a CLI or web UI | Low-code option |
| torchtune | PyTorch-native post-training recipes | Hackable recipes without heavy abstractions |
AI agent frameworks
Start here: Pydantic AI or the OpenAI Agents SDK for a small, typed agent; LangGraph when you need durable, branching workflows with human approval steps.
| Library | Use it for | Notes |
|---|---|---|
| Pydantic AI | Type-safe agents with tools and structured output | Model-agnostic, from the Pydantic team |
| OpenAI Agents SDK | Lightweight multi-agent workflows, handoffs, guardrails, tracing | Works with non-OpenAI models too |
| Claude Agent SDK | Build agents on the same harness as Claude Code | File, shell and MCP tools built in |
| LangGraph | Stateful agent graphs with persistence and human-in-the-loop | Low-level control, production features |
| LangChain | Integrations and building blocks for LLM apps and agents | Largest integration ecosystem |
| CrewAI | Role-based multi-agent “crews” and flows | Quick to prototype team-of-agents ideas |
| smolagents | Minimal agents, including agents that act by writing code | Small codebase, easy to read |
| Agno | Agents with memory, knowledge and tools, plus a runtime | Fast, batteries included |
| Google ADK | Agent Development Kit for building and deploying agents | Integrates with Gemini and Google Cloud |
| Semantic Kernel | Enterprise SDK for AI agents and plugins | Python, C# and Java |
| mem0 | Long-term memory layer for agents | Stores and retrieves user facts across sessions |
| browser-use | Let agents control a web browser | Playwright-based browser automation for LLMs |
Agent frameworks compared:
| Pydantic AI | OpenAI Agents SDK | LangGraph | CrewAI | smolagents | |
|---|---|---|---|---|---|
| Style | Typed Python functions and models | Agents, handoffs, guardrails | Explicit state graph | Roles, tasks and flows | Code-writing agents |
| Learning curve | Low | Low | Medium to high | Low | Low |
| Multi-agent | Yes | Yes (handoffs) | Yes (graph nodes) | Core idea | Yes |
| Persistence and resumability | Via integrations | Sessions | Built in (checkpointers) | Built in for flows | Basic |
| Good fit | Production apps that value types | Quick agents with tracing | Complex, long-running workflows | Prototyping agent teams | Learning, research |
Microsoft’s AutoGen repository was archived in 2026, so it is not listed; check Microsoft’s current agent tooling if you are on the Microsoft stack.
Model Context Protocol (MCP)
Start here: FastMCP to write an MCP server in a few lines.
| Library | Use it for | Notes |
|---|---|---|
| MCP Python SDK | Official SDK for MCP servers and clients | Reference implementation |
| FastMCP | High-level framework for MCP servers and clients | Decorators, auth, testing, deployment helpers |
# A tiny MCP server exposing one tool (pip install fastmcp)
from fastmcp import FastMCP
mcp = FastMCP("Dice")
@mcp.tool
def roll(sides: int = 6) -> int:
"""Roll a die with the given number of sides."""
import random
return random.randint(1, sides)
if __name__ == "__main__":
mcp.run()
RAG frameworks and vector search
Start here: LlamaIndex for a full RAG pipeline; FAISS, LanceDB or Chroma for the vector index itself.
| Library | Use it for | Notes |
|---|---|---|
| LlamaIndex | Data connectors, indexing and query engines for RAG | Many loaders and retrieval strategies |
| Haystack | Production pipelines for search, RAG and agents | Explicit, composable pipelines |
| txtai | All-in-one embeddings database, semantic search and workflows | Small footprint |
| Sentence Transformers | Embedding and reranker models, training them too | The standard for local embeddings |
| FAISS | Fast similarity search over dense vectors | Library, not a server; CPU and GPU |
| Chroma | Simple embedding database | Runs in-process or as a server |
| LanceDB | Embedded vector database on the Lance columnar format | Stores vectors with data, scales to disk |
| qdrant-client | Python client for the Qdrant vector database | Includes a local in-memory mode |
| pgvector-python | Vector search in PostgreSQL from Python | Keep vectors next to relational data |
| FAISS | Chroma | LanceDB | Qdrant | pgvector | |
|---|---|---|---|---|---|
| Deployment | Library | Embedded or server | Embedded or cloud | Server, embedded or cloud | PostgreSQL extension |
| Metadata filtering | Manual | Yes | Yes (SQL-like) | Yes, rich | Yes (SQL) |
| Best for | Raw speed, research | Prototypes | Local-first apps, large data on disk | Production vector search | Teams already on Postgres |
Document parsing and web data for LLMs
Start here: Docling for PDFs and office documents; Crawl4AI for websites.
| Library | Use it for | Notes |
|---|---|---|
| Docling | PDF, DOCX, PPTX, HTML and images to structured Markdown or JSON | Layout and table understanding |
| Marker | Accurate PDF to Markdown, including equations and tables | Apache-2.0 code; model weights have a separate license with limits on larger commercial use |
| MarkItDown | Convert many file types to Markdown for LLMs | Lightweight, from Microsoft |
| Unstructured | Partition documents into elements for RAG | Many file types |
| PyMuPDF | Fast PDF text, image and metadata extraction | AGPL or commercial license |
| Crawl4AI | Crawl and scrape websites into LLM-ready Markdown | Async, browser-based |
Evaluation and observability
Start here: DeepEval or Inspect for tests; Langfuse for tracing what your app does in production.
| Library | Use it for | Notes |
|---|---|---|
| DeepEval | Unit-test style LLM evaluations | Pytest-like, many metrics |
| Inspect | Framework for LLM evaluations and agent benchmarks | From the UK AI Security Institute |
| Ragas | RAG and agent evaluation metrics | Faithfulness, context precision and more |
| lm-evaluation-harness | Run standard academic benchmarks on models | Widely used for leaderboards |
| Langfuse | Tracing, prompt management and evals (Python SDK) | Open source platform, self-hostable |
| Arize Phoenix | Tracing and evaluation with OpenTelemetry | Runs locally in a notebook or as a server |
| Opik | Tracing, evaluation and dashboards for LLM apps | Open source, self-hostable |
| Evidently | Data drift, ML and LLM quality monitoring | Reports and test suites |
Natural language processing
Start here: Hugging Face Transformers for model-based NLP; spaCy for fast production pipelines.
| Library | Use it for | Notes |
|---|---|---|
| Transformers | Pretrained text, vision, audio and multimodal models | Model definitions for most open models |
| Tokenizers | Fast tokenizers written in Rust | Train your own tokenizer |
| Datasets | Load and process datasets efficiently | Streaming, Arrow-backed |
| spaCy | Industrial NLP: tokenization, NER, parsing | Fast and production-ready |
| NLTK | Classic NLP algorithms and corpora | Good for teaching |
| Gensim | Topic modeling and word vectors | LGPL license |
Computer vision
Start here: Ultralytics for detection and segmentation, plus supervision to process the results.
| Library | Use it for | Notes |
|---|---|---|
| OpenCV (opencv-python) | Image and video processing | Pip packages for OpenCV |
| Pillow | Image loading, saving and basic editing | The standard imaging library |
| scikit-image | Image processing algorithms | NumPy-based |
| torchvision | Datasets, transforms and models for PyTorch | Includes the v2 transforms API |
| Ultralytics | YOLO detection, segmentation, pose and tracking | AGPL or enterprise license |
| supervision | Annotate, count, track and filter detections | Model-agnostic utilities |
| Kornia | Differentiable computer vision in PyTorch | Augmentations and geometry on GPU |
| Detectron2 | Detection and segmentation research platform | From Meta AI |
| SAM 2 | Promptable segmentation in images and video | Segment Anything Model 2 |
| AlbumentationsX | Fast image augmentation | Successor of the archived Albumentations repo; AGPL or commercial |
Speech and audio
Start here: faster-whisper for transcription; Pipecat if you are building a real-time voice agent.
| Library | Use it for | Notes |
|---|---|---|
| Whisper | Multilingual speech recognition | Original reference implementation |
| faster-whisper | Whisper with CTranslate2, several times faster | Lower memory, quantization |
| WhisperX | Word-level timestamps and speaker diarization | Built on faster-whisper |
| pyannote.audio | Speaker diarization | Who spoke when |
| Kokoro | Small, high-quality text-to-speech | 82M-parameter open-weight model |
| Coqui TTS (Idiap fork) | Text-to-speech toolkit with many models | Maintained fork of the original Coqui TTS |
| NeMo Speech | NVIDIA’s speech recognition and TTS models and training | GPU-focused |
| SpeechBrain | Conversational AI and speech toolkit | Recipes for many speech tasks |
| librosa | Audio analysis and feature extraction | Spectrograms, beats, pitch |
| torchaudio | Audio I/O and transforms for PyTorch | |
| Pipecat | Real-time voice and multimodal agent pipelines | Plug together STT, LLM and TTS services |
Image generation
Start here: Diffusers for code; ComfyUI if you prefer a node-based UI.
| Library | Use it for | Notes |
|---|---|---|
| Diffusers | Diffusion pipelines for images, video and audio | Load most open image models |
| ComfyUI | Node-based diffusion workflows with a Python backend | GPL-3.0; huge custom node ecosystem |
| InvokeAI | Creative image generation app and engine | Polished UI for artists |
# Text-to-image with Diffusers (pip install diffusers transformers accelerate torch)
import torch
from diffusers import AutoPipelineForText2Image
pipe = AutoPipelineForText2Image.from_pretrained("<model-repo-id>", torch_dtype=torch.float16).to("cuda")
image = pipe("a watercolor fox reading a book").images[0]
image.save("fox.png")
Time series forecasting
Start here: statsforecast for fast, strong baselines.
| Library | Use it for | Notes |
|---|---|---|
| statsforecast | Fast statistical forecasting (ARIMA, ETS, Theta) | Scales to many series |
| Darts | One API for classical and deep learning forecasting | Backtesting built in |
| sktime | Unified framework for time series ML | scikit-learn style |
| Prophet | Business forecasting with seasonality and holidays | Easy to explain to stakeholders |
Reinforcement learning and robotics
| Library | Use it for | Notes |
|---|---|---|
| Gymnasium | Standard API and environments for RL | Maintained successor of OpenAI Gym |
| Stable-Baselines3 | Reliable implementations of RL algorithms | Start here for RL |
| CleanRL | Single-file RL implementations | Great for learning |
| MuJoCo | Physics simulation for robotics | Python bindings included |
| LeRobot | Models, datasets and tools for real-world robotics | From Hugging Face |
| Ray (RLlib) | Scalable RL as part of Ray | Distributed training |
Graph machine learning
| Library | Use it for | Notes |
|---|---|---|
| PyTorch Geometric | Graph neural networks in PyTorch | Large model zoo |
| DGL | Graph deep learning across frameworks | Scales to large graphs |
| NetworkX | Graph creation and classic graph algorithms | Pure Python, easy to learn |
Explainability and interpretability
| Library | Use it for | Notes |
|---|---|---|
| SHAP | Feature attributions for any model | Strong for tree models |
| Captum | Attribution methods for PyTorch models | Integrated gradients and more |
| TransformerLens | Mechanistic interpretability of language models | Hook into activations |
Data labeling, data quality and synthetic data
| Library | Use it for | Notes |
|---|---|---|
| Label Studio | Labeling text, images, audio and video | Self-hosted web app with a Python SDK |
| Argilla | Human feedback and dataset curation for AI | Integrates with Hugging Face |
| distilabel | Synthetic data and AI feedback pipelines | Generate SFT and preference datasets |
| cleanlab | Find label errors and data issues automatically | Works with any classifier |
MLOps, experiment tracking and deployment
Start here: MLflow for tracking and a model registry; BentoML or LitServe to serve models as APIs.
| Library | Use it for | Notes |
|---|---|---|
| MLflow | Experiment tracking, model registry, LLM tracing | Open source, self-hostable |
| Weights & Biases | Experiment tracking and collaboration (client library) | Hosted platform with a free tier |
| DVC | Version data and models alongside Git | Pipelines and experiments |
| Hydra | Composable configuration for experiments | Override any setting from the CLI |
| Ray | Distributed computing for training, tuning and serving | Ray Train, Tune, Serve |
| Prefect | Workflow orchestration in Python | Schedules, retries, observability |
| ZenML | MLOps pipelines across infrastructure | Pluggable stacks |
| BentoML | Package and serve models as APIs | Batching, containers |
| LitServe | Fast, flexible serving engine for any model | Built on FastAPI |
| FastAPI | Web APIs around your models | Type hints, async, automatic docs |
Demos, apps and notebooks
| Library | Use it for | Notes |
|---|---|---|
| Gradio | ML demos and chat UIs in a few lines | Powers Hugging Face Spaces |
| Streamlit | Data apps from Python scripts | Fast dashboards |
| JupyterLab | Notebook environment | The classic interactive workflow |
| marimo | Reactive Python notebooks stored as plain .py files |
Git-friendly, reproducible, can run as apps |
# A chat demo for any function in a few lines (pip install gradio)
import gradio as gr
def reply(message, history):
return f"You said: {message}"
gr.ChatInterface(reply).launch()
Visualization
| Library | Use it for | Notes |
|---|---|---|
| Matplotlib | Any static plot | The base layer |
| seaborn | Statistical plots with good defaults | Built on Matplotlib |
| Plotly | Interactive charts | Works in notebooks and web apps |
Python tooling for AI projects
| Tool | Use it for | Notes |
|---|---|---|
| uv | Fast Python and package manager | Replaces pip, venv and pyenv for most workflows |
| Ruff | Fast linter and formatter | Replaces flake8, isort and Black for most projects |
# A reproducible AI project in seconds
uv init my-ai-app && cd my-ai-app
uv add pandas scikit-learn
uv run python -c "import sklearn; print(sklearn.__version__)"
Starter stacks
Combinations that work well together for common projects:
| Project | Stack |
|---|---|
| Tabular prediction | pandas or Polars, scikit-learn, LightGBM, Optuna, SHAP, MLflow |
| Chat over your documents (RAG) | Docling, Sentence Transformers, LanceDB or Qdrant, LlamaIndex, Ragas, Langfuse |
| Typed AI agent | Pydantic AI or OpenAI Agents SDK, FastMCP for tools, Logfire, Langfuse or Phoenix for traces |
| Local private assistant | Ollama, ollama-python, Chroma, Gradio |
| Fine-tune an open model | Datasets, TRL, PEFT, Unsloth, lm-evaluation-harness |
| Voice agent | Pipecat, faster-whisper, Kokoro, an LLM SDK |
| Object detection product | Ultralytics, supervision, OpenCV, FastAPI |
| Forecasting service | Polars, statsforecast, Darts, Prefect |
FAQ
What is the best Python library for AI? There is no single one. For deep learning, PyTorch; for classical ML on tables, scikit-learn; for pretrained models, Hugging Face Transformers; for LLM apps, the provider SDK plus a framework like Pydantic AI or LlamaIndex.
PyTorch or TensorFlow in 2026? PyTorch for most new projects: it dominates research, open model releases and tutorials. TensorFlow is still common in existing production systems and mobile deployments, and Keras 3 lets you write models that run on either.
Do I need LangChain to build an LLM app? No. Many apps only need an SDK, a few functions and a vector store. Frameworks help when you need many integrations, complex agent graphs or built-in persistence. Start small and add a framework when the code calls for it.
pandas or Polars? pandas has the larger ecosystem and is fine for most datasets that fit in memory. Polars is faster, multi-threaded and has a lazy API that helps with big data. Many teams use both, converting through Arrow.
Which vector database should I use with Python? For prototypes, Chroma or LanceDB run in-process with no server. For production search with filters, Qdrant or pgvector (if you already run PostgreSQL). FAISS is a fast library rather than a database.
How do I run an LLM locally in Python?
Install Ollama and use ollama-python, or use llama-cpp-python with a GGUF model file. On Apple silicon, MLX LM is also a good option.
Which libraries are safe for commercial use? Most entries use permissive licenses (MIT, Apache-2.0, BSD). Watch for AGPL (Ultralytics, PyMuPDF, AlbumentationsX), GPL (ComfyUI) and LGPL (Gensim), and for model weights with restrictive terms (for example Marker’s models), and remember that model weights have their own licenses separate from the code.
How do I keep up with new AI libraries? Watch the release notes of the libraries you depend on, follow Hugging Face’s trending models and Spaces, and check this list’s updates. Prefer libraries with steady maintenance over the newest star count.
Where to go next
- Hugging Face course for Transformers, LLMs, agents and more
- scikit-learn user guide
- PyTorch tutorials
- fast.ai Practical Deep Learning
- Hugging Face Papers for new research papers, many with code and models
Contributing
PRs are welcome. To add a library:
- It should be a Python library that is actively maintained and genuinely useful for an AI or ML task.
- Add it to the right table with a short, factual “Use it for” line in your own words.
- Note copyleft licenses.
- Keep entries accurate; remove or flag libraries that are archived or unmaintained.
License
Content is licensed under CC BY 4.0.
If this helped you, a star helps others find it.
More free resources
Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.